@excalidraw/element 0.18.0-91c7748 → 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 +15101 -8988
- 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/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +81 -39
- package/dist/types/common/src/constants.d.ts +89 -34
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +5 -1
- 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/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +52 -78
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +12 -8
- 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 +85 -51
- package/dist/types/element/src/bounds.d.ts +25 -18
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +11 -3
- package/dist/types/element/src/comparisons.d.ts +10 -7
- 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 +30 -3
- package/dist/types/element/src/duplicate.d.ts +67 -6
- 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 +4 -4
- package/dist/types/element/src/frame.d.ts +16 -11
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +9 -4
- package/dist/types/element/src/linearElementEditor.d.ts +48 -30
- package/dist/types/element/src/mutateElement.d.ts +6 -2
- package/dist/types/element/src/newElement.d.ts +59 -9
- package/dist/types/element/src/renderElement.d.ts +21 -13
- package/dist/types/element/src/resizeElements.d.ts +12 -12
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +14 -14
- package/dist/types/element/src/shape.d.ts +36 -9
- 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/textMeasurements.d.ts +1 -3
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +27 -8
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +30 -31
- package/dist/types/element/src/types.d.ts +55 -20
- package/dist/types/element/src/utils.d.ts +22 -6
- package/dist/types/element/src/visualdebug.d.ts +58 -0
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +215 -189
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +150 -133
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +543 -1576
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +152 -880
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +73 -65
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +237 -214
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +65 -63
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +149 -132
- package/dist/types/excalidraw/actions/actionExport.d.ts +228 -1423
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -396
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +373 -521
- package/dist/types/excalidraw/actions/actionGroup.d.ts +160 -151
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +236 -214
- package/dist/types/excalidraw/actions/actionLink.d.ts +72 -64
- package/dist/types/excalidraw/actions/actionMenu.d.ts +64 -430
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -361
- package/dist/types/excalidraw/actions/actionProperties.d.ts +241 -2560
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +80 -76
- package/dist/types/excalidraw/actions/actionStyles.d.ts +74 -65
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +88 -79
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +77 -70
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +74 -66
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +65 -64
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +74 -66
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +75 -67
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +75 -67
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -3
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +5 -3
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +11 -7
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +50 -20
- 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 +13 -38
- package/dist/types/excalidraw/components/Actions.d.ts +26 -11
- 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 +646 -132
- 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/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -5
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -4
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- 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/InlineIcon.d.ts +3 -1
- 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 +6 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- 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 +5 -7
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- 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 +2 -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/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- 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/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
- 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/index.d.ts +7 -8
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- 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/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
- 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/Trans.d.ts +2 -2
- 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 +10 -4
- 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 +47 -35
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- 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/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
- 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/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/dist/types/excalidraw/components/icons.d.ts +51 -23
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- 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 +373 -8
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
- package/dist/types/excalidraw/data/index.d.ts +8 -9
- package/dist/types/excalidraw/data/json.d.ts +192 -3
- package/dist/types/excalidraw/data/library.d.ts +25 -10
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +25 -10
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/errors.d.ts +14 -0
- 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 +2 -2
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- 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 +16 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
- package/dist/types/excalidraw/scene/Renderer.d.ts +491 -19
- package/dist/types/excalidraw/scene/export.d.ts +4 -4
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +28 -8
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +12 -12
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +644 -60
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +14 -5
- 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 +26 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +9 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +9 -8
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +8 -8
- package/package.json +10 -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 -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/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
- 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 -10
- 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 -85
- 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 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
- 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,39 +1,71 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type EXPORT_IMAGE_TYPES, Emitter } 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";
|
|
15
|
+
import { isOverScrollBars } from "../scene/scrollbars";
|
|
13
16
|
import { LassoTrail } from "../lasso";
|
|
14
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";
|
|
15
31
|
import type { ExportedElements } from "../data";
|
|
16
|
-
import type {
|
|
17
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, 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";
|
|
18
33
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
19
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
|
+
};
|
|
20
49
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
21
50
|
container: HTMLDivElement | null;
|
|
22
51
|
id: string | null;
|
|
23
52
|
}>;
|
|
53
|
+
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
|
|
54
|
+
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
|
|
24
55
|
export declare const useApp: () => AppClassProperties;
|
|
25
56
|
export declare const useAppProps: () => AppProps;
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
canFitSidebar: boolean;
|
|
34
|
-
};
|
|
57
|
+
export declare const useEditorInterface: () => Readonly<{
|
|
58
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
59
|
+
desktopUIMode: "compact" | "full";
|
|
60
|
+
userAgent: Readonly<{
|
|
61
|
+
isMobileDevice: boolean;
|
|
62
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
63
|
+
}>;
|
|
35
64
|
isTouchScreen: boolean;
|
|
65
|
+
canFitSidebar: boolean;
|
|
66
|
+
isLandscape: boolean;
|
|
36
67
|
}>;
|
|
68
|
+
export declare const useStylesPanelMode: () => StylesPanelMode;
|
|
37
69
|
export declare const useExcalidrawContainer: () => {
|
|
38
70
|
container: HTMLDivElement | null;
|
|
39
71
|
id: string | null;
|
|
@@ -42,24 +74,35 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
42
74
|
export declare const useExcalidrawAppState: () => AppState;
|
|
43
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;
|
|
44
76
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
77
|
+
/**
|
|
78
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
79
|
+
*/
|
|
80
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
45
81
|
declare class App extends React.Component<AppProps, AppState> {
|
|
46
82
|
canvas: AppClassProperties["canvas"];
|
|
47
83
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
84
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
48
85
|
rc: RoughCanvas;
|
|
49
86
|
unmounted: boolean;
|
|
50
87
|
actionManager: ActionManager;
|
|
51
|
-
|
|
88
|
+
editorInterface: EditorInterface;
|
|
89
|
+
private stylesPanelMode;
|
|
52
90
|
private excalidrawContainerRef;
|
|
91
|
+
private zenModeTransitionTimer;
|
|
92
|
+
get ownerDocument(): Document;
|
|
93
|
+
get ownerWindow(): Window & typeof globalThis;
|
|
53
94
|
scene: Scene;
|
|
54
95
|
fonts: Fonts;
|
|
55
96
|
renderer: Renderer;
|
|
56
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;
|
|
57
101
|
private resizeObserver;
|
|
58
|
-
private nearestScrollableContainer;
|
|
59
102
|
library: AppClassProperties["library"];
|
|
60
103
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
61
104
|
id: string;
|
|
62
|
-
|
|
105
|
+
store: Store;
|
|
63
106
|
private history;
|
|
64
107
|
excalidrawContainerValue: {
|
|
65
108
|
container: HTMLDivElement | null;
|
|
@@ -78,26 +121,52 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
121
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
79
122
|
* insert to DOM before user initially scrolls to them) */
|
|
80
123
|
private initializedEmbeds;
|
|
81
|
-
private handleToastClose;
|
|
82
124
|
private elementsPendingErasure;
|
|
83
|
-
|
|
84
|
-
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;
|
|
140
|
+
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
141
|
+
private textWysiwygSubmitHandler;
|
|
85
142
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
86
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;
|
|
87
151
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
152
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
88
153
|
lastPointerMoveEvent: PointerEvent | null;
|
|
154
|
+
/** current frame pointer cords */
|
|
89
155
|
lastPointerMoveCoords: {
|
|
90
156
|
x: number;
|
|
91
157
|
y: number;
|
|
92
158
|
} | null;
|
|
93
|
-
|
|
159
|
+
private lastCompletedCanvasClicks;
|
|
160
|
+
/** previous frame pointer coords */
|
|
161
|
+
previousPointerMoveCoords: {
|
|
94
162
|
x: number;
|
|
95
163
|
y: number;
|
|
96
|
-
};
|
|
97
|
-
|
|
164
|
+
} | null;
|
|
165
|
+
drawShape: AppDrawShape;
|
|
98
166
|
laserTrails: LaserTrails;
|
|
99
167
|
eraserTrail: EraserTrail;
|
|
100
168
|
lassoTrail: LassoTrail;
|
|
169
|
+
cursorHints: CursorHints;
|
|
101
170
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
102
171
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
103
172
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -112,11 +181,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
112
181
|
x: number;
|
|
113
182
|
y: number;
|
|
114
183
|
}>;
|
|
115
|
-
scrollbars:
|
|
116
|
-
isOverEither: boolean;
|
|
117
|
-
isOverHorizontal: boolean;
|
|
118
|
-
isOverVertical: boolean;
|
|
119
|
-
};
|
|
184
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
120
185
|
lastCoords: {
|
|
121
186
|
x: number;
|
|
122
187
|
y: number;
|
|
@@ -129,7 +194,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
129
194
|
x: number;
|
|
130
195
|
y: number;
|
|
131
196
|
};
|
|
132
|
-
arrowDirection: "
|
|
197
|
+
arrowDirection: "origin" | "end";
|
|
133
198
|
center: {
|
|
134
199
|
x: number;
|
|
135
200
|
y: number;
|
|
@@ -141,6 +206,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
141
206
|
wasAddedToSelection: boolean;
|
|
142
207
|
hasBeenDuplicated: boolean;
|
|
143
208
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
209
|
+
arrowLabel: boolean;
|
|
144
210
|
};
|
|
145
211
|
withCmdOrCtrl: boolean;
|
|
146
212
|
drag: {
|
|
@@ -156,14 +222,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
156
222
|
blockDragging: boolean;
|
|
157
223
|
};
|
|
158
224
|
eventListeners: {
|
|
159
|
-
onMove:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} | null;
|
|
164
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
165
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
166
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
225
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
226
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
227
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
228
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
167
229
|
};
|
|
168
230
|
boxSelection: {
|
|
169
231
|
hasOccurred: boolean;
|
|
@@ -182,11 +244,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
182
244
|
x: number;
|
|
183
245
|
y: number;
|
|
184
246
|
}>;
|
|
185
|
-
scrollbars:
|
|
186
|
-
isOverEither: boolean;
|
|
187
|
-
isOverHorizontal: boolean;
|
|
188
|
-
isOverVertical: boolean;
|
|
189
|
-
};
|
|
247
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
190
248
|
lastCoords: {
|
|
191
249
|
x: number;
|
|
192
250
|
y: number;
|
|
@@ -199,7 +257,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
199
257
|
x: number;
|
|
200
258
|
y: number;
|
|
201
259
|
};
|
|
202
|
-
arrowDirection: "
|
|
260
|
+
arrowDirection: "origin" | "end";
|
|
203
261
|
center: {
|
|
204
262
|
x: number;
|
|
205
263
|
y: number;
|
|
@@ -211,6 +269,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
211
269
|
wasAddedToSelection: boolean;
|
|
212
270
|
hasBeenDuplicated: boolean;
|
|
213
271
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
272
|
+
arrowLabel: boolean;
|
|
214
273
|
};
|
|
215
274
|
withCmdOrCtrl: boolean;
|
|
216
275
|
drag: {
|
|
@@ -226,14 +285,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
226
285
|
blockDragging: boolean;
|
|
227
286
|
};
|
|
228
287
|
eventListeners: {
|
|
229
|
-
onMove:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} | null;
|
|
234
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
235
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
236
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
288
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
289
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
290
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
291
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
237
292
|
};
|
|
238
293
|
boxSelection: {
|
|
239
294
|
hasOccurred: boolean;
|
|
@@ -245,18 +300,107 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
245
300
|
}>]>;
|
|
246
301
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
247
302
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
248
|
-
|
|
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;
|
|
249
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;
|
|
250
381
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
251
382
|
private onWindowMessage;
|
|
383
|
+
private handleSkipBindMode;
|
|
384
|
+
private resetDelayedBindMode;
|
|
385
|
+
private previousHoveredBindableElement;
|
|
386
|
+
private handleDelayedBindModeChange;
|
|
252
387
|
private cacheEmbeddableRef;
|
|
253
388
|
/**
|
|
254
389
|
* Returns gridSize taking into account `gridModeEnabled`.
|
|
255
390
|
* If disabled, returns null.
|
|
256
391
|
*/
|
|
257
392
|
getEffectiveGridSize: () => NullableGridSize;
|
|
393
|
+
private getTextCreationGridPoint;
|
|
258
394
|
private getHTMLIFrameElement;
|
|
259
|
-
|
|
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;
|
|
260
404
|
private isIframeLikeElementCenter;
|
|
261
405
|
private updateEmbedValidationStatus;
|
|
262
406
|
private updateEmbeddables;
|
|
@@ -269,11 +413,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
269
413
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
270
414
|
focusContainer: AppClassProperties["focusContainer"];
|
|
271
415
|
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
272
|
-
getSceneElementsMapIncludingDeleted: () =>
|
|
416
|
+
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
|
|
273
417
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
274
418
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
275
419
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
276
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
420
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
277
421
|
}) => Promise<void>;
|
|
278
422
|
private magicGenerations;
|
|
279
423
|
private updateMagicGeneration;
|
|
@@ -289,9 +433,35 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
289
433
|
private openEyeDropper;
|
|
290
434
|
dismissLinearEditor: () => void;
|
|
291
435
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
436
|
+
scheduleCapture: () => void;
|
|
292
437
|
private onBlur;
|
|
293
438
|
private onUnload;
|
|
294
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;
|
|
295
465
|
private resetHistory;
|
|
296
466
|
private resetStore;
|
|
297
467
|
/**
|
|
@@ -300,10 +470,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
300
470
|
*/
|
|
301
471
|
private resetScene;
|
|
302
472
|
private initializeScene;
|
|
303
|
-
private
|
|
304
|
-
|
|
305
|
-
private
|
|
306
|
-
|
|
473
|
+
private getFormFactor;
|
|
474
|
+
refreshEditorInterface: () => void;
|
|
475
|
+
private reconcileStylesPanelMode;
|
|
476
|
+
/** TO BE USED LATER */
|
|
477
|
+
private setDesktopUIMode;
|
|
307
478
|
private clearImageShapeCache;
|
|
308
479
|
componentDidMount(): Promise<void>;
|
|
309
480
|
componentWillUnmount(): void;
|
|
@@ -312,6 +483,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
312
483
|
private onFullscreenChange;
|
|
313
484
|
private removeEventListeners;
|
|
314
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;
|
|
315
494
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
316
495
|
private renderInteractiveSceneCallback;
|
|
317
496
|
private onScroll;
|
|
@@ -330,54 +509,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
330
509
|
clientY: number;
|
|
331
510
|
} | "cursor" | "center";
|
|
332
511
|
retainSeed?: boolean;
|
|
333
|
-
|
|
512
|
+
fit?: SetViewportOptions["fit"];
|
|
513
|
+
preserveFrameChildrenOrder?: boolean;
|
|
334
514
|
}) => void;
|
|
335
515
|
private addElementsFromMixedContentPaste;
|
|
336
516
|
private addTextFromPaste;
|
|
337
517
|
setAppState: React.Component<any, AppState>["setState"];
|
|
338
518
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
339
519
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
340
|
-
updateFrameRendering: (opts: Partial<
|
|
341
|
-
enabled: boolean;
|
|
342
|
-
name: boolean;
|
|
343
|
-
outline: boolean;
|
|
344
|
-
clip: boolean;
|
|
345
|
-
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
520
|
+
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
346
521
|
togglePenMode: (force: boolean | null) => void;
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
*
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
duration?: number;
|
|
359
|
-
} | {
|
|
360
|
-
fitToContent?: never;
|
|
361
|
-
fitToViewport?: boolean;
|
|
362
|
-
/** when fitToViewport=true, how much screen should the content cover,
|
|
363
|
-
* between 0.1 (10%) and 1 (100%)
|
|
364
|
-
*/
|
|
365
|
-
viewportZoomFactor?: number;
|
|
366
|
-
animate?: boolean;
|
|
367
|
-
duration?: number;
|
|
368
|
-
}) & {
|
|
369
|
-
minZoom?: number;
|
|
370
|
-
maxZoom?: number;
|
|
371
|
-
canvasOffsets?: Offsets;
|
|
372
|
-
}) => void;
|
|
373
|
-
private maybeUnfollowRemoteUser;
|
|
374
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
375
|
-
private translateCanvas;
|
|
376
|
-
setToast: (toast: {
|
|
377
|
-
message: string;
|
|
378
|
-
closable?: boolean;
|
|
379
|
-
duration?: number;
|
|
380
|
-
} | 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;
|
|
381
533
|
restoreFileFromShare: () => Promise<void>;
|
|
382
534
|
/**
|
|
383
535
|
* adds supplied files to existing files in the appState.
|
|
@@ -387,7 +539,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
387
539
|
private addMissingFiles;
|
|
388
540
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
389
541
|
elements?: SceneData["elements"];
|
|
390
|
-
appState?: Pick<AppState, K> | null
|
|
542
|
+
appState?: Pick<AppState, K> | null;
|
|
391
543
|
collaborators?: SceneData["collaborators"];
|
|
392
544
|
/**
|
|
393
545
|
* Controls which updates should be captured by the `Store`. Captured updates are emmitted and listened to by other components, such as `History` for undo / redo purposes.
|
|
@@ -402,22 +554,26 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
402
554
|
*/
|
|
403
555
|
captureUpdate?: SceneData["captureUpdate"];
|
|
404
556
|
}) => void;
|
|
557
|
+
/**
|
|
558
|
+
* see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details
|
|
559
|
+
*/
|
|
560
|
+
setElementRenderOverrides: (overrides: ElementRenderOverrides | null) => void;
|
|
405
561
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
406
562
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
407
|
-
|
|
563
|
+
triggerRender: (
|
|
564
|
+
/** force always re-renders canvas even if no change */
|
|
565
|
+
force?: boolean) => void;
|
|
408
566
|
/**
|
|
409
567
|
* @returns whether the menu was toggled on or off
|
|
410
568
|
*/
|
|
411
569
|
toggleSidebar: ({ name, tab, force, }: {
|
|
412
570
|
name: SidebarName | null;
|
|
413
|
-
tab?:
|
|
414
|
-
force?: boolean
|
|
571
|
+
tab?: SidebarTabName;
|
|
572
|
+
force?: boolean;
|
|
415
573
|
}) => boolean;
|
|
416
574
|
private updateCurrentCursorPosition;
|
|
417
|
-
getEditorUIOffsets: () => Offsets;
|
|
418
575
|
private onKeyDown;
|
|
419
576
|
private onKeyUp;
|
|
420
|
-
private isToolSupported;
|
|
421
577
|
setActiveTool: (tool: ({
|
|
422
578
|
type: ToolType;
|
|
423
579
|
} | {
|
|
@@ -426,10 +582,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
426
582
|
}) & {
|
|
427
583
|
locked?: boolean;
|
|
428
584
|
fromSelection?: boolean;
|
|
429
|
-
},
|
|
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;
|
|
430
596
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
431
|
-
private setCursor;
|
|
432
|
-
private resetCursor;
|
|
433
597
|
/**
|
|
434
598
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
435
599
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -441,26 +605,351 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
441
605
|
private onGestureStart;
|
|
442
606
|
private onGestureChange;
|
|
443
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;
|
|
444
629
|
private handleTextWysiwyg;
|
|
445
630
|
private deselectElements;
|
|
446
|
-
private
|
|
447
|
-
private
|
|
448
|
-
|
|
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>[];
|
|
449
648
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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;
|
|
453
888
|
private startImageCropping;
|
|
454
889
|
private finishImageCropping;
|
|
890
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
455
891
|
private handleCanvasDoubleClick;
|
|
892
|
+
private handleCanvasClick;
|
|
456
893
|
private getElementLinkAtPosition;
|
|
457
|
-
private
|
|
458
|
-
|
|
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;
|
|
459
937
|
private handleCanvasPointerMove;
|
|
460
938
|
private handleEraser;
|
|
461
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
|
+
*/
|
|
462
944
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
463
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;
|
|
464
953
|
private handleCanvasPointerUp;
|
|
465
954
|
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
|
|
466
955
|
private resetContextMenuTimer;
|
|
@@ -470,8 +959,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
470
959
|
* pointerup handlers manually
|
|
471
960
|
*/
|
|
472
961
|
private maybeCleanupAfterMissingPointerUp;
|
|
473
|
-
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
474
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;
|
|
475
968
|
private initialPointerDownState;
|
|
476
969
|
private handleDraggingScrollBar;
|
|
477
970
|
private clearSelectionIfNotUsingSelection;
|
|
@@ -481,7 +974,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
481
974
|
private handleSelectionOnPointerDown;
|
|
482
975
|
private isASelectedElement;
|
|
483
976
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
484
|
-
private handleTextOnPointerDown;
|
|
485
977
|
private handleFreeDrawElementOnPointerDown;
|
|
486
978
|
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
487
979
|
sceneX: number;
|
|
@@ -496,11 +988,14 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
496
988
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
497
989
|
private newImagePlaceholder;
|
|
498
990
|
private handleLinearElementOnPointerDown;
|
|
499
|
-
|
|
991
|
+
getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
|
|
992
|
+
type: 2 | 3;
|
|
993
|
+
} | null;
|
|
994
|
+
getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
|
|
500
995
|
private createGenericElementOnPointerDown;
|
|
501
996
|
private createFrameElementOnPointerDown;
|
|
502
|
-
|
|
503
|
-
|
|
997
|
+
maybeCacheReferenceSnapPoints(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
998
|
+
maybeCacheVisibleGaps(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
504
999
|
private onKeyDownFromPointerDownHandler;
|
|
505
1000
|
private onKeyUpFromPointerDownHandler;
|
|
506
1001
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -525,25 +1020,43 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
525
1020
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
526
1021
|
* to render new images. This is just a failsafe */
|
|
527
1022
|
private scheduleImageRefresh;
|
|
528
|
-
private updateBindingEnabledOnPointerMove;
|
|
529
|
-
private maybeSuggestBindingAtCursor;
|
|
530
1023
|
private clearSelection;
|
|
531
1024
|
private handleInteractiveCanvasRef;
|
|
532
1025
|
private insertImages;
|
|
533
1026
|
private handleAppOnDrop;
|
|
534
|
-
|
|
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>;
|
|
535
1032
|
private handleCanvasContextMenu;
|
|
536
|
-
|
|
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;
|
|
537
1041
|
private maybeHandleCrop;
|
|
538
1042
|
private maybeHandleResize;
|
|
539
1043
|
private getContextMenuItems;
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
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
|
+
};
|
|
544
1056
|
private updateDOMRect;
|
|
545
1057
|
refresh: () => void;
|
|
546
1058
|
private getCanvasOffsets;
|
|
1059
|
+
watchState: () => void;
|
|
547
1060
|
private updateLanguage;
|
|
548
1061
|
}
|
|
549
1062
|
declare global {
|
|
@@ -553,6 +1066,7 @@ declare global {
|
|
|
553
1066
|
elements: readonly ExcalidrawElement[];
|
|
554
1067
|
state: AppState;
|
|
555
1068
|
setState: React.Component<any, AppState>["setState"];
|
|
1069
|
+
watchState: (prev: any, next: any) => void | undefined;
|
|
556
1070
|
app: InstanceType<typeof App>;
|
|
557
1071
|
history: History;
|
|
558
1072
|
store: Store;
|