@excalidraw/element 0.18.0-9ba0f5d → 0.18.0-a52cd20
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 +13141 -8453
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +20 -19
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +24 -2
- package/dist/types/common/src/constants.d.ts +70 -7
- package/dist/types/common/src/index.d.ts +3 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +10 -50
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +9 -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/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +30 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +37 -17
- package/dist/types/element/src/bounds.d.ts +23 -8
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +7 -3
- 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/delta.d.ts +23 -1
- package/dist/types/element/src/distribute.d.ts +3 -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/elbowArrow.d.ts +2 -0
- 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 +9 -9
- package/dist/types/element/src/index.d.ts +8 -1
- package/dist/types/element/src/linearElementEditor.d.ts +32 -10
- package/dist/types/element/src/mutateElement.d.ts +3 -1
- package/dist/types/element/src/newElement.d.ts +53 -3
- package/dist/types/element/src/renderElement.d.ts +21 -7
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +11 -7
- package/dist/types/element/src/shape.d.ts +28 -2
- 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 +21 -10
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- 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 +48 -9
- package/dist/types/element/src/utils.d.ts +19 -6
- package/dist/types/element/src/visualdebug.d.ts +1 -2
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +125 -53
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +85 -37
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +356 -1019
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +84 -36
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +42 -18
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +130 -55
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +38 -18
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +85 -37
- package/dist/types/excalidraw/actions/actionExport.d.ts +133 -359
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +187 -236
- package/dist/types/excalidraw/actions/actionGroup.d.ts +100 -52
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +99 -21
- package/dist/types/excalidraw/actions/actionLink.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionMenu.d.ts +38 -18
- package/dist/types/excalidraw/actions/actionProperties.d.ts +120 -56
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +46 -22
- package/dist/types/excalidraw/actions/actionStyles.d.ts +43 -18
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +57 -32
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +46 -23
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +42 -23
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +44 -20
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +43 -19
- 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 +39 -13
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +6 -7
- 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.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +604 -89
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -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/AppStateObserver.d.ts +37 -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/CommandPalette/types.d.ts +1 -1
- 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/IconPicker.d.ts +14 -9
- 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/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/PasteChartDialog.d.ts +4 -5
- 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/PropertiesPopover.d.ts +1 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- 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/Chat/ChatInterface.d.ts +2 -6
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +4 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- 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 +4 -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/DropdownMenu.d.ts +30 -16
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- 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 +30 -10
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
- 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 +107 -60
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +6 -7
- package/dist/types/excalidraw/data/json.d.ts +62 -30
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- 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/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +619 -42
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -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 +8 -2
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/math/src/types.d.ts +25 -1
- 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 +4 -3
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
- 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/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
- package/dist/types/excalidraw/components/shapes.d.ts +0 -190
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -46
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- 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,27 +1,57 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor,
|
|
4
|
-
import type {
|
|
2
|
+
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
+
import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
|
+
import type { LocalPoint, Radians } from "@excalidraw/math";
|
|
5
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
6
|
+
import type { ArrowEndpoint, TransformHandleDirection } from "@excalidraw/element";
|
|
5
7
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
8
|
import { ActionManager } from "../actions/manager";
|
|
7
|
-
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
8
9
|
import { History } from "../history";
|
|
9
10
|
import { Fonts } from "../fonts";
|
|
10
11
|
import { type WritableAtom } from "../editor-jotai";
|
|
11
12
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
-
import {
|
|
13
|
+
import { type SetViewportOptions } from "../viewport";
|
|
14
|
+
import { LaserTrails } from "../laserTrails";
|
|
13
15
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
14
16
|
import { LassoTrail } from "../lasso";
|
|
15
17
|
import { EraserTrail } from "../eraser";
|
|
18
|
+
import { AppArrowText } from "./App.arrowText";
|
|
19
|
+
import { AppTextTool } from "./App.textTool";
|
|
20
|
+
import { AppBucketFill } from "./App.bucketFill";
|
|
21
|
+
import { AppToolDrag } from "./App.toolDrag";
|
|
22
|
+
import { AppCursor } from "./App.cursor";
|
|
23
|
+
import { AppDrawShape } from "./App.drawshape";
|
|
24
|
+
import { AppDuplicate } from "./App.duplicate";
|
|
25
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
26
|
+
import { AppPan } from "./App.pan";
|
|
27
|
+
import { AppViewport } from "./App.viewport";
|
|
28
|
+
import { AppWheel } from "./App.wheel";
|
|
29
|
+
import { CursorHints } from "./CursorHint";
|
|
30
|
+
import { type OnStateChange } from "./AppStateObserver";
|
|
16
31
|
import type { ExportedElements } from "../data";
|
|
17
|
-
import type {
|
|
18
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
32
|
+
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, PointerDownState, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig, ViewportUIName } from "../types";
|
|
19
33
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
20
34
|
import type { ActionResult } from "../actions/types";
|
|
35
|
+
declare const editorLifecycleEventBehavior: {
|
|
36
|
+
readonly "editor:mount": {
|
|
37
|
+
readonly cardinality: "once";
|
|
38
|
+
readonly replay: "last";
|
|
39
|
+
};
|
|
40
|
+
readonly "editor:initialize": {
|
|
41
|
+
readonly cardinality: "once";
|
|
42
|
+
readonly replay: "last";
|
|
43
|
+
};
|
|
44
|
+
readonly "editor:unmount": {
|
|
45
|
+
readonly cardinality: "once";
|
|
46
|
+
readonly replay: "last";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
21
49
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
22
50
|
container: HTMLDivElement | null;
|
|
23
51
|
id: string | null;
|
|
24
52
|
}>;
|
|
53
|
+
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
|
|
54
|
+
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
|
|
25
55
|
export declare const useApp: () => AppClassProperties;
|
|
26
56
|
export declare const useAppProps: () => AppProps;
|
|
27
57
|
export declare const useEditorInterface: () => Readonly<{
|
|
@@ -44,24 +74,35 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
44
74
|
export declare const useExcalidrawAppState: () => AppState;
|
|
45
75
|
export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
|
|
46
76
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
77
|
+
/**
|
|
78
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
79
|
+
*/
|
|
80
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
47
81
|
declare class App extends React.Component<AppProps, AppState> {
|
|
48
82
|
canvas: AppClassProperties["canvas"];
|
|
49
83
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
84
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
50
85
|
rc: RoughCanvas;
|
|
51
86
|
unmounted: boolean;
|
|
52
87
|
actionManager: ActionManager;
|
|
53
88
|
editorInterface: EditorInterface;
|
|
54
89
|
private stylesPanelMode;
|
|
55
90
|
private excalidrawContainerRef;
|
|
91
|
+
private zenModeTransitionTimer;
|
|
92
|
+
get ownerDocument(): Document;
|
|
93
|
+
get ownerWindow(): Window & typeof globalThis;
|
|
56
94
|
scene: Scene;
|
|
57
95
|
fonts: Fonts;
|
|
58
96
|
renderer: Renderer;
|
|
59
97
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
98
|
+
/** whether the last render had any renderable elements (excludes e.g. the
|
|
99
|
+
* in-progress `newElement` and the edited text element) */
|
|
100
|
+
private hasRenderableElements;
|
|
60
101
|
private resizeObserver;
|
|
61
102
|
library: AppClassProperties["library"];
|
|
62
103
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
63
104
|
id: string;
|
|
64
|
-
|
|
105
|
+
store: Store;
|
|
65
106
|
private history;
|
|
66
107
|
excalidrawContainerValue: {
|
|
67
108
|
container: HTMLDivElement | null;
|
|
@@ -80,27 +121,52 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
80
121
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
81
122
|
* insert to DOM before user initially scrolls to them) */
|
|
82
123
|
private initializedEmbeds;
|
|
83
|
-
private handleToastClose;
|
|
84
124
|
private elementsPendingErasure;
|
|
85
|
-
|
|
86
|
-
private
|
|
125
|
+
private _initialized;
|
|
126
|
+
private readonly editorLifecycleEvents;
|
|
127
|
+
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
128
|
+
private appStateObserver;
|
|
129
|
+
onStateChange: OnStateChange;
|
|
130
|
+
bucketFill: AppBucketFill;
|
|
131
|
+
duplicate: AppDuplicate;
|
|
132
|
+
toolDrag: AppToolDrag;
|
|
133
|
+
flowchart: AppFlowchart;
|
|
134
|
+
cursor: AppCursor;
|
|
135
|
+
arrowText: AppArrowText;
|
|
136
|
+
pan: AppPan;
|
|
137
|
+
textTool: AppTextTool;
|
|
138
|
+
viewport: AppViewport;
|
|
139
|
+
wheel: AppWheel;
|
|
87
140
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
141
|
+
private textWysiwygSubmitHandler;
|
|
88
142
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
89
143
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
144
|
+
/**
|
|
145
|
+
* the handle of the resize in progress while `state.isResizing` — for UI
|
|
146
|
+
* that words itself by handle (a sticky note's corners resize
|
|
147
|
+
* proportionally, its edges freely); not app state, so it costs no
|
|
148
|
+
* re-render of its own
|
|
149
|
+
*/
|
|
150
|
+
activeResizeHandle: TransformHandleDirection | null;
|
|
90
151
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
152
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
91
153
|
lastPointerMoveEvent: PointerEvent | null;
|
|
154
|
+
/** current frame pointer cords */
|
|
92
155
|
lastPointerMoveCoords: {
|
|
93
156
|
x: number;
|
|
94
157
|
y: number;
|
|
95
158
|
} | null;
|
|
96
|
-
|
|
159
|
+
private lastCompletedCanvasClicks;
|
|
160
|
+
/** previous frame pointer coords */
|
|
161
|
+
previousPointerMoveCoords: {
|
|
97
162
|
x: number;
|
|
98
163
|
y: number;
|
|
99
|
-
};
|
|
100
|
-
|
|
164
|
+
} | null;
|
|
165
|
+
drawShape: AppDrawShape;
|
|
101
166
|
laserTrails: LaserTrails;
|
|
102
167
|
eraserTrail: EraserTrail;
|
|
103
168
|
lassoTrail: LassoTrail;
|
|
169
|
+
cursorHints: CursorHints;
|
|
104
170
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
105
171
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
106
172
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -140,6 +206,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
140
206
|
wasAddedToSelection: boolean;
|
|
141
207
|
hasBeenDuplicated: boolean;
|
|
142
208
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
209
|
+
arrowLabel: boolean;
|
|
143
210
|
};
|
|
144
211
|
withCmdOrCtrl: boolean;
|
|
145
212
|
drag: {
|
|
@@ -202,6 +269,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
202
269
|
wasAddedToSelection: boolean;
|
|
203
270
|
hasBeenDuplicated: boolean;
|
|
204
271
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
272
|
+
arrowLabel: boolean;
|
|
205
273
|
};
|
|
206
274
|
withCmdOrCtrl: boolean;
|
|
207
275
|
drag: {
|
|
@@ -232,7 +300,84 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
232
300
|
}>]>;
|
|
233
301
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
234
302
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
303
|
+
api: ExcalidrawImperativeAPI;
|
|
304
|
+
private elementRenderOverrides;
|
|
305
|
+
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
306
|
+
private elementRenderOffsets;
|
|
307
|
+
private renderOverridesUpdatePending;
|
|
308
|
+
private getRenderOverrideConfig;
|
|
309
|
+
private getElementRenderState;
|
|
310
|
+
private createExcalidrawAPI;
|
|
235
311
|
constructor(props: AppProps);
|
|
312
|
+
/**
|
|
313
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
314
|
+
* clipboard, drag&drop). When `false`, the editor is fully inert for the
|
|
315
|
+
* user, but remains controllable through the imperative API.
|
|
316
|
+
*
|
|
317
|
+
* All user-input entry points must consult this getter (directly or by
|
|
318
|
+
* not being attached/rendered at all).
|
|
319
|
+
*/
|
|
320
|
+
isInteractionEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Whether element links render their link icon and are clickable.
|
|
323
|
+
* True when fully interactive, or when `interaction: { enabled: { links:
|
|
324
|
+
* true } }`
|
|
325
|
+
* (in which case clicking anywhere on a linked element opens the link,
|
|
326
|
+
* same as in view mode).
|
|
327
|
+
*/
|
|
328
|
+
isLinksEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Whether canvas navigation — panning & zooming, view-mode style — is
|
|
331
|
+
* enabled. True when fully interactive, or when `interaction: { enabled:
|
|
332
|
+
* { navigation: true } }`. Respects `appState.scrollConstraints`.
|
|
333
|
+
*/
|
|
334
|
+
isNavigationEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Whether embeddable & iframe elements are interactive (hover & click to
|
|
337
|
+
* activate, view-mode style). True when fully interactive, or when
|
|
338
|
+
* allowed via `interaction.enabled.embeds` / `.interactiveContent`.
|
|
339
|
+
*/
|
|
340
|
+
isEmbedsEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Whether the browser's own zoom (ctrl/cmd + wheel, pinch, keyboard
|
|
343
|
+
* shortcuts) stays available over the non-interactive editor.
|
|
344
|
+
* Prevented by default.
|
|
345
|
+
*/
|
|
346
|
+
isBrowserZoomEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Whether the tool can be activated & driven by user input. False when
|
|
349
|
+
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
350
|
+
* and the tool isn't kept user-driven via `interaction.enabled.tools`.
|
|
351
|
+
*
|
|
352
|
+
* (Once UI tool availability is split from input availability — e.g.
|
|
353
|
+
* `props.ui.tools` vs `interaction.disabled.tools` — the UI axis moves
|
|
354
|
+
* out into its own predicate.)
|
|
355
|
+
*
|
|
356
|
+
* We purposely widen the `tool` type so this helper can be called with
|
|
357
|
+
* any tool without having to type check it.
|
|
358
|
+
*/
|
|
359
|
+
isToolSupported: <T extends ToolType | "custom">(tool: T, props?: Pick<AppProps, "interaction" | "UIOptions">) => boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Whether the active tool is locked in place — via the tool lock
|
|
362
|
+
* (padlock / Q) or by being host-forced (`props.activeTool`). A locked
|
|
363
|
+
* tool doesn't revert to the selection tool after use, and elements drawn
|
|
364
|
+
* with it aren't selected. Forcing deliberately does not mutate
|
|
365
|
+
* `activeTool.locked`, which is the user's persisted padlock preference.
|
|
366
|
+
*/
|
|
367
|
+
isToolLocked(): boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Whether the active tool captures the primary pointer instead of the
|
|
370
|
+
* view-mode drag-to-pan — the laser and host-implemented custom tools do;
|
|
371
|
+
* while non-interactive, any tool allowed via
|
|
372
|
+
* `interaction.enabled.tools` does. (Editing tools capture the pointer
|
|
373
|
+
* trivially since view mode implies they're not active; this predicate only
|
|
374
|
+
* matters where view-mode gates apply.)
|
|
375
|
+
*/
|
|
376
|
+
isActiveToolPointerCapturing(): boolean;
|
|
377
|
+
/** Whether Excalidraw's full default UI is rendered. */
|
|
378
|
+
isDefaultUIEnabled(props?: Pick<AppProps, "ui">): boolean;
|
|
379
|
+
/** Whether an individual default UI control is rendered. */
|
|
380
|
+
isUIControlEnabled(control: keyof UIConfig["enabled"], props?: Pick<AppProps, "ui">): boolean;
|
|
236
381
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
237
382
|
private onWindowMessage;
|
|
238
383
|
private handleSkipBindMode;
|
|
@@ -245,8 +390,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
245
390
|
* If disabled, returns null.
|
|
246
391
|
*/
|
|
247
392
|
getEffectiveGridSize: () => NullableGridSize;
|
|
393
|
+
private getTextCreationGridPoint;
|
|
248
394
|
private getHTMLIFrameElement;
|
|
249
|
-
|
|
395
|
+
/**
|
|
396
|
+
* AI-generated iframe elements aren't interactive while their generation
|
|
397
|
+
* is still in progress (the partial content is render-only).
|
|
398
|
+
*/
|
|
399
|
+
private isIframeLikeInteractive;
|
|
400
|
+
private handleIframeLikeElementHover;
|
|
401
|
+
/** @returns true if iframe-like element click handled */
|
|
402
|
+
private handleIframeLikeCenterClick;
|
|
403
|
+
private isDoubleClick;
|
|
250
404
|
private isIframeLikeElementCenter;
|
|
251
405
|
private updateEmbedValidationStatus;
|
|
252
406
|
private updateEmbeddables;
|
|
@@ -263,7 +417,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
263
417
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
264
418
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
265
419
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
266
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
420
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
267
421
|
}) => Promise<void>;
|
|
268
422
|
private magicGenerations;
|
|
269
423
|
private updateMagicGeneration;
|
|
@@ -279,9 +433,35 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
279
433
|
private openEyeDropper;
|
|
280
434
|
dismissLinearEditor: () => void;
|
|
281
435
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
436
|
+
scheduleCapture: () => void;
|
|
282
437
|
private onBlur;
|
|
283
438
|
private onUnload;
|
|
284
439
|
private disableEvent;
|
|
440
|
+
private isFileDropEnabled;
|
|
441
|
+
private onDragOver;
|
|
442
|
+
private handleNavigationModeKeyDown;
|
|
443
|
+
/**
|
|
444
|
+
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
445
|
+
* horizontally with shift. Respects `appState.scrollConstraints`
|
|
446
|
+
* (via `viewport.translate`).
|
|
447
|
+
*/
|
|
448
|
+
private maybeHandlePageScrollKeyDown;
|
|
449
|
+
private preventBrowserZoomKeyDown;
|
|
450
|
+
/** Ends active input sessions before switching to a view-mode/non-interactive
|
|
451
|
+
* mode. */
|
|
452
|
+
private terminateActiveInteraction;
|
|
453
|
+
private handleInteractionStateChange;
|
|
454
|
+
/** whether the two values reference the same tool (incl. custom subtype) */
|
|
455
|
+
private isSameForcedTool;
|
|
456
|
+
/**
|
|
457
|
+
* Keeps `state.activeTool` synced to the host-controlled
|
|
458
|
+
* `props.activeTool`. `setActiveTool` refuses non-matching activations
|
|
459
|
+
* while forced (user input, API); this backstop covers the writers that
|
|
460
|
+
* bypass the funnel (`actionFinalize`/`actionDeselect`, `restore()` on
|
|
461
|
+
* scene load, ...) and re-applies the tool once it becomes activatable
|
|
462
|
+
* (e.g. `interaction` config changes).
|
|
463
|
+
*/
|
|
464
|
+
private handleForcedToolChange;
|
|
285
465
|
private resetHistory;
|
|
286
466
|
private resetStore;
|
|
287
467
|
/**
|
|
@@ -303,6 +483,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
303
483
|
private onFullscreenChange;
|
|
304
484
|
private removeEventListeners;
|
|
305
485
|
private addEventListeners;
|
|
486
|
+
getSnapshotBeforeUpdate(prevProps: AppProps, prevState: AppState): null;
|
|
487
|
+
/**
|
|
488
|
+
* Flags the container while toggling zen mode so that UI chrome
|
|
489
|
+
* (backgrounds etc.) animates only then, and hover transitions stay
|
|
490
|
+
* instant. A data attribute so that React doesn't reset it on re-render.
|
|
491
|
+
*/
|
|
492
|
+
private markZenModeTransition;
|
|
493
|
+
private unmarkZenModeTransition;
|
|
306
494
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
307
495
|
private renderInteractiveSceneCallback;
|
|
308
496
|
private onScroll;
|
|
@@ -321,7 +509,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
321
509
|
clientY: number;
|
|
322
510
|
} | "cursor" | "center";
|
|
323
511
|
retainSeed?: boolean;
|
|
324
|
-
|
|
512
|
+
fit?: SetViewportOptions["fit"];
|
|
513
|
+
preserveFrameChildrenOrder?: boolean;
|
|
325
514
|
}) => void;
|
|
326
515
|
private addElementsFromMixedContentPaste;
|
|
327
516
|
private addTextFromPaste;
|
|
@@ -330,52 +519,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
330
519
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
331
520
|
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
332
521
|
togglePenMode: (force: boolean | null) => void;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
*
|
|
336
|
-
*/
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
private
|
|
344
|
-
scrollToContent: (
|
|
345
|
-
/**
|
|
346
|
-
* target to scroll to
|
|
347
|
-
*
|
|
348
|
-
* - string - id of element or group, or url containing elementLink
|
|
349
|
-
* - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
|
|
350
|
-
*/
|
|
351
|
-
target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
|
|
352
|
-
fitToContent?: boolean;
|
|
353
|
-
fitToViewport?: never;
|
|
354
|
-
viewportZoomFactor?: number;
|
|
355
|
-
animate?: boolean;
|
|
356
|
-
duration?: number;
|
|
357
|
-
} | {
|
|
358
|
-
fitToContent?: never;
|
|
359
|
-
fitToViewport?: boolean;
|
|
360
|
-
/** when fitToViewport=true, how much screen should the content cover,
|
|
361
|
-
* between 0.1 (10%) and 1 (100%)
|
|
362
|
-
*/
|
|
363
|
-
viewportZoomFactor?: number;
|
|
364
|
-
animate?: boolean;
|
|
365
|
-
duration?: number;
|
|
366
|
-
}) & {
|
|
367
|
-
minZoom?: number;
|
|
368
|
-
maxZoom?: number;
|
|
369
|
-
canvasOffsets?: Offsets;
|
|
370
|
-
}) => void;
|
|
371
|
-
private maybeUnfollowRemoteUser;
|
|
372
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
373
|
-
private translateCanvas;
|
|
374
|
-
setToast: (toast: {
|
|
375
|
-
message: string;
|
|
376
|
-
closable?: boolean;
|
|
377
|
-
duration?: number;
|
|
378
|
-
} | null) => void;
|
|
522
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
523
|
+
/** emits a follow/unfollow intent to the host (which owns the
|
|
524
|
+
* `userToFollow` state) via both the `onUserFollow` prop and the
|
|
525
|
+
* imperative API emitter */
|
|
526
|
+
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
527
|
+
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
528
|
+
* viewport changes that take the view over from the followed user (user
|
|
529
|
+
* pans and zooms, `setViewport` navigation) */
|
|
530
|
+
requestUnfollow: () => void;
|
|
531
|
+
setToast: (toast: AppState["toast"]) => void;
|
|
532
|
+
private showSceneReplacedToast;
|
|
379
533
|
restoreFileFromShare: () => Promise<void>;
|
|
380
534
|
/**
|
|
381
535
|
* adds supplied files to existing files in the appState.
|
|
@@ -400,9 +554,15 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
400
554
|
*/
|
|
401
555
|
captureUpdate?: SceneData["captureUpdate"];
|
|
402
556
|
}) => void;
|
|
557
|
+
/**
|
|
558
|
+
* see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details
|
|
559
|
+
*/
|
|
560
|
+
setElementRenderOverrides: (overrides: ElementRenderOverrides | null) => void;
|
|
403
561
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
404
562
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
405
|
-
|
|
563
|
+
triggerRender: (
|
|
564
|
+
/** force always re-renders canvas even if no change */
|
|
565
|
+
force?: boolean) => void;
|
|
406
566
|
/**
|
|
407
567
|
* @returns whether the menu was toggled on or off
|
|
408
568
|
*/
|
|
@@ -412,10 +572,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
412
572
|
force?: boolean;
|
|
413
573
|
}) => boolean;
|
|
414
574
|
private updateCurrentCursorPosition;
|
|
415
|
-
getEditorUIOffsets: () => Offsets;
|
|
416
575
|
private onKeyDown;
|
|
417
576
|
private onKeyUp;
|
|
418
|
-
private isToolSupported;
|
|
419
577
|
setActiveTool: (tool: ({
|
|
420
578
|
type: ToolType;
|
|
421
579
|
} | {
|
|
@@ -424,10 +582,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
424
582
|
}) & {
|
|
425
583
|
locked?: boolean;
|
|
426
584
|
fromSelection?: boolean;
|
|
427
|
-
},
|
|
585
|
+
}, opts?: {
|
|
586
|
+
keepSelection?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
589
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
590
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
591
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
592
|
+
* activation can switch back to it).
|
|
593
|
+
*/
|
|
594
|
+
toggle?: boolean;
|
|
595
|
+
}) => void;
|
|
428
596
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
429
|
-
private setCursor;
|
|
430
|
-
private resetCursor;
|
|
431
597
|
/**
|
|
432
598
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
433
599
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -439,26 +605,351 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
439
605
|
private onGestureStart;
|
|
440
606
|
private onGestureChange;
|
|
441
607
|
private onGestureEnd;
|
|
608
|
+
/**
|
|
609
|
+
* The side panels, besides the sidebar, that a typed or pasted text is
|
|
610
|
+
* kept clear of: the stats panel, and the full styles panel (desktop),
|
|
611
|
+
* which shows next to a text while it's edited, and once it's pasted and
|
|
612
|
+
* selected.
|
|
613
|
+
*/
|
|
614
|
+
getTextSidePanels: () => ViewportUIName[];
|
|
615
|
+
/**
|
|
616
|
+
* The part of the canvas a typed or pasted text is kept within, as offsets
|
|
617
|
+
* from its edges (screen px): all of it but the sidebar and the side
|
|
618
|
+
* panels (see getTextSidePanels), less some room at each side. The stats
|
|
619
|
+
* panel covers the top of a side only, and counts only for a text beside
|
|
620
|
+
* it: one (given by its scene bounds) with rows within that room of it.
|
|
621
|
+
*/
|
|
622
|
+
private getTextViewportOffsets;
|
|
623
|
+
/**
|
|
624
|
+
* The widest a text may grow to as it's typed or pasted, in scene units:
|
|
625
|
+
* TEXT_MAX_WRAP_WIDTH, or less, so that a text never outgrows the part of
|
|
626
|
+
* the canvas it's kept within.
|
|
627
|
+
*/
|
|
628
|
+
private getMaxTextWidth;
|
|
442
629
|
private handleTextWysiwyg;
|
|
443
630
|
private deselectElements;
|
|
444
|
-
private
|
|
445
|
-
private
|
|
446
|
-
|
|
631
|
+
private getSelectedTextElement;
|
|
632
|
+
private getSelectedTextEditingContainerAtPosition;
|
|
633
|
+
getTextElementAtPosition(x: number, y: number): NonDeleted<ExcalidrawTextElement> | null;
|
|
634
|
+
private isHittingTextAutoResizeHandle;
|
|
635
|
+
private handleTextAutoResizeHandlePointerDown;
|
|
636
|
+
getElementAtPosition(x: number, y: number, opts?: ({
|
|
637
|
+
includeBoundTextElement?: boolean;
|
|
638
|
+
includeLockedElements?: boolean;
|
|
639
|
+
} | {
|
|
640
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
641
|
+
}) & {
|
|
642
|
+
preferSelected?: boolean;
|
|
643
|
+
}): NonDeleted<ExcalidrawElement> | null;
|
|
644
|
+
getElementsAtPosition(x: number, y: number, opts?: {
|
|
645
|
+
includeBoundTextElement?: boolean;
|
|
646
|
+
includeLockedElements?: boolean;
|
|
647
|
+
}): NonDeleted<ExcalidrawElement>[];
|
|
447
648
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
649
|
+
hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
|
|
650
|
+
/**
|
|
651
|
+
* The text container at a position — an arrow hit on its path, any other
|
|
652
|
+
* container hit anywhere in its bounds (frames are skipped so a container
|
|
653
|
+
* inside one can be hit). Purely positional: the selection plays no part.
|
|
654
|
+
*/
|
|
655
|
+
getTextBindableContainerAtPosition(x: number, y: number): (Readonly<{
|
|
656
|
+
id: string;
|
|
657
|
+
x: number;
|
|
658
|
+
y: number;
|
|
659
|
+
strokeColor: string;
|
|
660
|
+
backgroundColor: string;
|
|
661
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
662
|
+
strokeWidth: number;
|
|
663
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
664
|
+
roundness: null | {
|
|
665
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
666
|
+
value?: number;
|
|
667
|
+
};
|
|
668
|
+
roughness: number;
|
|
669
|
+
opacity: number;
|
|
670
|
+
width: number;
|
|
671
|
+
height: number;
|
|
672
|
+
angle: Radians;
|
|
673
|
+
seed: number;
|
|
674
|
+
version: number;
|
|
675
|
+
versionNonce: number;
|
|
676
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
677
|
+
isDeleted: boolean;
|
|
678
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
679
|
+
frameId: string | null;
|
|
680
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
681
|
+
updated: number;
|
|
682
|
+
created: number | null;
|
|
683
|
+
link: string | null;
|
|
684
|
+
locked: boolean;
|
|
685
|
+
customData?: Record<string, any>;
|
|
686
|
+
}> & {
|
|
687
|
+
type: "rectangle";
|
|
688
|
+
} & {
|
|
689
|
+
isDeleted: false;
|
|
690
|
+
} & {
|
|
691
|
+
index: import("@excalidraw/element/types").FractionalIndex;
|
|
692
|
+
}) | (Readonly<{
|
|
693
|
+
id: string;
|
|
694
|
+
x: number;
|
|
695
|
+
y: number;
|
|
696
|
+
strokeColor: string;
|
|
697
|
+
backgroundColor: string;
|
|
698
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
699
|
+
strokeWidth: number;
|
|
700
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
701
|
+
roundness: null | {
|
|
702
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
703
|
+
value?: number;
|
|
704
|
+
};
|
|
705
|
+
roughness: number;
|
|
706
|
+
opacity: number;
|
|
707
|
+
width: number;
|
|
708
|
+
height: number;
|
|
709
|
+
angle: Radians;
|
|
710
|
+
seed: number;
|
|
711
|
+
version: number;
|
|
712
|
+
versionNonce: number;
|
|
713
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
714
|
+
isDeleted: boolean;
|
|
715
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
716
|
+
frameId: string | null;
|
|
717
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
718
|
+
updated: number;
|
|
719
|
+
created: number | null;
|
|
720
|
+
link: string | null;
|
|
721
|
+
locked: boolean;
|
|
722
|
+
customData?: Record<string, any>;
|
|
723
|
+
}> & Readonly<{
|
|
724
|
+
type: "stickynote";
|
|
725
|
+
baseHeight: number;
|
|
726
|
+
}> & {
|
|
727
|
+
isDeleted: false;
|
|
728
|
+
} & {
|
|
729
|
+
index: import("@excalidraw/element/types").FractionalIndex;
|
|
730
|
+
}) | (Readonly<{
|
|
731
|
+
id: string;
|
|
732
|
+
x: number;
|
|
733
|
+
y: number;
|
|
734
|
+
strokeColor: string;
|
|
735
|
+
backgroundColor: string;
|
|
736
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
737
|
+
strokeWidth: number;
|
|
738
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
739
|
+
roundness: null | {
|
|
740
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
741
|
+
value?: number;
|
|
742
|
+
};
|
|
743
|
+
roughness: number;
|
|
744
|
+
opacity: number;
|
|
745
|
+
width: number;
|
|
746
|
+
height: number;
|
|
747
|
+
angle: Radians;
|
|
748
|
+
seed: number;
|
|
749
|
+
version: number;
|
|
750
|
+
versionNonce: number;
|
|
751
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
752
|
+
isDeleted: boolean;
|
|
753
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
754
|
+
frameId: string | null;
|
|
755
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
756
|
+
updated: number;
|
|
757
|
+
created: number | null;
|
|
758
|
+
link: string | null;
|
|
759
|
+
locked: boolean;
|
|
760
|
+
customData?: Record<string, any>;
|
|
761
|
+
}> & {
|
|
762
|
+
type: "diamond";
|
|
763
|
+
} & {
|
|
764
|
+
isDeleted: false;
|
|
765
|
+
} & {
|
|
766
|
+
index: import("@excalidraw/element/types").FractionalIndex;
|
|
767
|
+
}) | (Readonly<{
|
|
768
|
+
id: string;
|
|
769
|
+
x: number;
|
|
770
|
+
y: number;
|
|
771
|
+
strokeColor: string;
|
|
772
|
+
backgroundColor: string;
|
|
773
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
774
|
+
strokeWidth: number;
|
|
775
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
776
|
+
roundness: null | {
|
|
777
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
778
|
+
value?: number;
|
|
779
|
+
};
|
|
780
|
+
roughness: number;
|
|
781
|
+
opacity: number;
|
|
782
|
+
width: number;
|
|
783
|
+
height: number;
|
|
784
|
+
angle: Radians;
|
|
785
|
+
seed: number;
|
|
786
|
+
version: number;
|
|
787
|
+
versionNonce: number;
|
|
788
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
789
|
+
isDeleted: boolean;
|
|
790
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
791
|
+
frameId: string | null;
|
|
792
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
793
|
+
updated: number;
|
|
794
|
+
created: number | null;
|
|
795
|
+
link: string | null;
|
|
796
|
+
locked: boolean;
|
|
797
|
+
customData?: Record<string, any>;
|
|
798
|
+
}> & {
|
|
799
|
+
type: "ellipse";
|
|
800
|
+
} & {
|
|
801
|
+
isDeleted: false;
|
|
802
|
+
} & {
|
|
803
|
+
index: import("@excalidraw/element/types").FractionalIndex;
|
|
804
|
+
}) | (Readonly<{
|
|
805
|
+
id: string;
|
|
806
|
+
x: number;
|
|
807
|
+
y: number;
|
|
808
|
+
strokeColor: string;
|
|
809
|
+
backgroundColor: string;
|
|
810
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
811
|
+
strokeWidth: number;
|
|
812
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
813
|
+
roundness: null | {
|
|
814
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
815
|
+
value?: number;
|
|
816
|
+
};
|
|
817
|
+
roughness: number;
|
|
818
|
+
opacity: number;
|
|
819
|
+
width: number;
|
|
820
|
+
height: number;
|
|
821
|
+
angle: Radians;
|
|
822
|
+
seed: number;
|
|
823
|
+
version: number;
|
|
824
|
+
versionNonce: number;
|
|
825
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
826
|
+
isDeleted: boolean;
|
|
827
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
828
|
+
frameId: string | null;
|
|
829
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
830
|
+
updated: number;
|
|
831
|
+
created: number | null;
|
|
832
|
+
link: string | null;
|
|
833
|
+
locked: boolean;
|
|
834
|
+
customData?: Record<string, any>;
|
|
835
|
+
}> & Readonly<{
|
|
836
|
+
type: "line" | "arrow";
|
|
837
|
+
points: readonly LocalPoint[];
|
|
838
|
+
startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
839
|
+
endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
840
|
+
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
841
|
+
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
842
|
+
}> & {
|
|
843
|
+
isDeleted: false;
|
|
844
|
+
} & {
|
|
845
|
+
index: import("@excalidraw/element/types").FractionalIndex;
|
|
846
|
+
} & Readonly<{
|
|
847
|
+
type: "arrow";
|
|
848
|
+
elbowed: boolean;
|
|
849
|
+
}>) | null;
|
|
850
|
+
/**
|
|
851
|
+
* Whether a text element's content is still being authored.
|
|
852
|
+
*
|
|
853
|
+
* Creating a text reverts the tool to selection during pointerdown, so the
|
|
854
|
+
* pointerup that follows looks like an ordinary canvas click and would
|
|
855
|
+
* capture the still-empty element as a history entry of its own. Undo would
|
|
856
|
+
* then rewind only the typing, restoring an invisible, zero-content element
|
|
857
|
+
* (and, for an endpoint label, leaving the arrow bound to it) rather than
|
|
858
|
+
* removing it. The editor's own submit captures the finished text instead,
|
|
859
|
+
* so the whole create-and-type lands in a single entry.
|
|
860
|
+
*/
|
|
861
|
+
private isEditingTextContent;
|
|
862
|
+
startTextEditing: ({ sceneX, sceneY, insertAtParentCenter, container, autoEdit, initialCaretSceneCoords, arrowEndpoint, textElement, }: {
|
|
863
|
+
/** X position to insert text at */
|
|
864
|
+
sceneX: number;
|
|
865
|
+
/** Y position to insert text at */
|
|
866
|
+
sceneY: number;
|
|
867
|
+
/** whether to attempt to insert at element center if applicable */
|
|
868
|
+
insertAtParentCenter?: boolean;
|
|
869
|
+
container?: ExcalidrawTextContainer | null;
|
|
870
|
+
autoEdit?: boolean;
|
|
871
|
+
initialCaretSceneCoords?: {
|
|
872
|
+
x: number;
|
|
873
|
+
y: number;
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* creates the text as a label for this arrow endpoint: the binding then
|
|
877
|
+
* dictates the text's position and alignment, overriding (sceneX, sceneY)
|
|
878
|
+
*/
|
|
879
|
+
arrowEndpoint?: ArrowEndpoint | null;
|
|
880
|
+
/**
|
|
881
|
+
* the text to edit: an element to edit exactly that one; `null` to always
|
|
882
|
+
* create, never adopting a selected text or one under the pointer;
|
|
883
|
+
* `undefined` to resolve it here — a single selected text, the label of a
|
|
884
|
+
* selected or passed arrow container, else the text at (sceneX, sceneY)
|
|
885
|
+
*/
|
|
886
|
+
textElement?: NonDeleted<ExcalidrawTextElement> | null;
|
|
887
|
+
}) => void;
|
|
451
888
|
private startImageCropping;
|
|
452
889
|
private finishImageCropping;
|
|
890
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
453
891
|
private handleCanvasDoubleClick;
|
|
892
|
+
private handleCanvasClick;
|
|
454
893
|
private getElementLinkAtPosition;
|
|
455
|
-
private
|
|
456
|
-
|
|
894
|
+
private handleElementLinkClick;
|
|
895
|
+
/**
|
|
896
|
+
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
897
|
+
* and tooltip — based on the current `hitLinkElement`. Returns whether a
|
|
898
|
+
* link is being hovered.
|
|
899
|
+
*/
|
|
900
|
+
private applyElementLinkHoverAffordance;
|
|
901
|
+
/**
|
|
902
|
+
* On touchscreens (where no hover precedes the tap) re-derives
|
|
903
|
+
* `hitLinkElement`, then opens the hit element link, if any.
|
|
904
|
+
* Returns whether a link click was handled.
|
|
905
|
+
*/
|
|
906
|
+
private maybeHandleElementLinkClick;
|
|
907
|
+
/**
|
|
908
|
+
* Restricted pointer handling for the non-interactive editor with links
|
|
909
|
+
* and/or embeds allowed (`interaction.enabled.links` / `.embeds` /
|
|
910
|
+
* `.interactiveContent`) — runs only the element-link & embed concerns
|
|
911
|
+
* (shared with the full pointer handlers above) so they behave like in
|
|
912
|
+
* view mode without the rest of the canvas pointer machinery.
|
|
913
|
+
*/
|
|
914
|
+
private handleInteractiveContentPointerMove;
|
|
915
|
+
private handleInteractiveContentPointerUp;
|
|
916
|
+
/**
|
|
917
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
918
|
+
* inside frames)
|
|
919
|
+
*/
|
|
920
|
+
getTopLayerFrameAtSceneCoords: (
|
|
921
|
+
/**
|
|
922
|
+
* should be already grid aligned (basically should be what the call site
|
|
923
|
+
* sets the element's coords to, if applicable)
|
|
924
|
+
*/
|
|
925
|
+
sceneCoords: {
|
|
926
|
+
x: number;
|
|
927
|
+
y: number;
|
|
928
|
+
}, opts?: {
|
|
929
|
+
/** to exclude selected elements when dragging, etc. */
|
|
930
|
+
excludeElementIds?: AppState["selectedElementIds"];
|
|
931
|
+
currentFrameId?: ExcalidrawElement["frameId"];
|
|
932
|
+
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
933
|
+
private updateFrameToHighlight;
|
|
934
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
935
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
936
|
+
insertNewElement: (element: ExcalidrawElement) => void;
|
|
457
937
|
private handleCanvasPointerMove;
|
|
458
938
|
private handleEraser;
|
|
459
939
|
private handleTouchMove;
|
|
940
|
+
/**
|
|
941
|
+
* Applies the hover affordances of a selected linear element: the cursor,
|
|
942
|
+
* plus the hovered-handle state that renders them highlighted.
|
|
943
|
+
*/
|
|
460
944
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
461
945
|
private handleCanvasPointerDown;
|
|
946
|
+
/**
|
|
947
|
+
* The browser took the pointer over (scroll, pinch, palm rejection): no
|
|
948
|
+
* pointerup will follow, so the gesture is torn down here and now — the
|
|
949
|
+
* same cleanup a lost pointerup gets at the next press, only not left
|
|
950
|
+
* lying in wait for it, where its replay would tangle with that press.
|
|
951
|
+
*/
|
|
952
|
+
private handleCanvasPointerCancel;
|
|
462
953
|
private handleCanvasPointerUp;
|
|
463
954
|
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
|
|
464
955
|
private resetContextMenuTimer;
|
|
@@ -468,8 +959,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
468
959
|
* pointerup handlers manually
|
|
469
960
|
*/
|
|
470
961
|
private maybeCleanupAfterMissingPointerUp;
|
|
471
|
-
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
472
962
|
private updateGestureOnPointerDown;
|
|
963
|
+
/**
|
|
964
|
+
* Tracks the pointer within the ongoing multi-touch gesture and applies
|
|
965
|
+
* the two-finger pinch zoom/pan, if any.
|
|
966
|
+
*/
|
|
967
|
+
private updateMultiTouchGesture;
|
|
473
968
|
private initialPointerDownState;
|
|
474
969
|
private handleDraggingScrollBar;
|
|
475
970
|
private clearSelectionIfNotUsingSelection;
|
|
@@ -479,7 +974,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
479
974
|
private handleSelectionOnPointerDown;
|
|
480
975
|
private isASelectedElement;
|
|
481
976
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
482
|
-
private handleTextOnPointerDown;
|
|
483
977
|
private handleFreeDrawElementOnPointerDown;
|
|
484
978
|
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
485
979
|
sceneX: number;
|
|
@@ -494,11 +988,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
494
988
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
495
989
|
private newImagePlaceholder;
|
|
496
990
|
private handleLinearElementOnPointerDown;
|
|
497
|
-
|
|
991
|
+
getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
|
|
992
|
+
type: 2 | 3;
|
|
993
|
+
} | null;
|
|
994
|
+
getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
|
|
498
995
|
private createGenericElementOnPointerDown;
|
|
499
996
|
private createFrameElementOnPointerDown;
|
|
500
|
-
|
|
501
|
-
|
|
997
|
+
maybeCacheReferenceSnapPoints(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
998
|
+
maybeCacheVisibleGaps(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
502
999
|
private onKeyDownFromPointerDownHandler;
|
|
503
1000
|
private onKeyUpFromPointerDownHandler;
|
|
504
1001
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -523,21 +1020,39 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
523
1020
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
524
1021
|
* to render new images. This is just a failsafe */
|
|
525
1022
|
private scheduleImageRefresh;
|
|
526
|
-
private updateBindingEnabledOnPointerMove;
|
|
527
1023
|
private clearSelection;
|
|
528
1024
|
private handleInteractiveCanvasRef;
|
|
529
1025
|
private insertImages;
|
|
530
1026
|
private handleAppOnDrop;
|
|
531
|
-
|
|
1027
|
+
/** @returns true if the file replaced the scene */
|
|
1028
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null, insertPosition?: {
|
|
1029
|
+
clientX: number;
|
|
1030
|
+
clientY: number;
|
|
1031
|
+
}) => Promise<true | undefined>;
|
|
532
1032
|
private handleCanvasContextMenu;
|
|
533
|
-
|
|
1033
|
+
/** opens the context menu for the element under the pointer, or the canvas */
|
|
1034
|
+
openContextMenu: (pointer: {
|
|
1035
|
+
clientX: number;
|
|
1036
|
+
clientY: number;
|
|
1037
|
+
button?: number;
|
|
1038
|
+
pointerType?: string;
|
|
1039
|
+
}) => void;
|
|
1040
|
+
maybeDragNewGenericElement: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent, informMutation?: boolean) => void;
|
|
534
1041
|
private maybeHandleCrop;
|
|
535
1042
|
private maybeHandleResize;
|
|
536
1043
|
private getContextMenuItems;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
1044
|
+
getTextWysiwygSnappedToCenterPosition(x: number, y: number, appState: AppState, container?: ExcalidrawTextContainer | null): {
|
|
1045
|
+
viewportX: number;
|
|
1046
|
+
viewportY: number;
|
|
1047
|
+
elementCenterX: number;
|
|
1048
|
+
elementCenterY: number;
|
|
1049
|
+
} | undefined;
|
|
1050
|
+
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
1051
|
+
resetShouldCacheIgnoreZoomDebounced: {
|
|
1052
|
+
(): void;
|
|
1053
|
+
flush(): void;
|
|
1054
|
+
cancel(): void;
|
|
1055
|
+
};
|
|
541
1056
|
private updateDOMRect;
|
|
542
1057
|
refresh: () => void;
|
|
543
1058
|
private getCanvasOffsets;
|