@excalidraw/element 0.18.0-0fc927cb4 → 0.18.0-1118751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +17651 -11362
- 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 +100 -33
- 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 +47 -77
- 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 +77 -51
- package/dist/types/element/src/bounds.d.ts +26 -19
- 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 +25 -3
- 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 +10 -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 +44 -8
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +23 -12
- 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/store.d.ts +3 -2
- package/dist/types/element/src/textElement.d.ts +15 -11
- 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 +191 -186
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +134 -131
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +488 -1563
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +136 -874
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +65 -64
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +213 -211
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +171 -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 +57 -62
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +133 -130
- package/dist/types/excalidraw/actions/actionExport.d.ts +212 -1414
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +350 -518
- package/dist/types/excalidraw/actions/actionGroup.d.ts +144 -149
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +229 -214
- package/dist/types/excalidraw/actions/actionLink.d.ts +64 -63
- package/dist/types/excalidraw/actions/actionMenu.d.ts +56 -427
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +222 -2533
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +72 -75
- package/dist/types/excalidraw/actions/actionStyles.d.ts +66 -64
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +80 -78
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +69 -69
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +187 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +66 -65
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +57 -63
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +66 -65
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +67 -66
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +67 -66
- 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 +49 -19
- 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 +57 -19
- package/dist/types/excalidraw/components/Actions.d.ts +33 -11
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +583 -135
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +54 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/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 -4
- 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/FilledButton.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -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 +1 -1
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- 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 +2 -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/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 +56 -22
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +25 -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 +357 -12
- 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 +184 -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/data/types.d.ts +4 -1
- 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 +14 -0
- 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 +629 -58
- package/dist/types/excalidraw/viewport.d.ts +281 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +8 -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 +10 -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 -62
- 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,70 @@
|
|
|
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 { AppBucketFill } from "./App.bucketFill";
|
|
20
|
+
import { AppToolDrag } from "./App.toolDrag";
|
|
21
|
+
import { AppCursor } from "./App.cursor";
|
|
22
|
+
import { AppDrawShape } from "./App.drawshape";
|
|
23
|
+
import { AppDuplicate } from "./App.duplicate";
|
|
24
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
25
|
+
import { AppPan } from "./App.pan";
|
|
26
|
+
import { AppViewport } from "./App.viewport";
|
|
27
|
+
import { AppWheel } from "./App.wheel";
|
|
28
|
+
import { CursorHints } from "./CursorHint";
|
|
29
|
+
import { type OnStateChange } from "./AppStateObserver";
|
|
15
30
|
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";
|
|
31
|
+
import type { AppClassProperties, AppProps, AppState, ElementRenderOverrides, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, KeyboardModifiersObject, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, UIConfig } from "../types";
|
|
18
32
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
19
33
|
import type { ActionResult } from "../actions/types";
|
|
34
|
+
declare const editorLifecycleEventBehavior: {
|
|
35
|
+
readonly "editor:mount": {
|
|
36
|
+
readonly cardinality: "once";
|
|
37
|
+
readonly replay: "last";
|
|
38
|
+
};
|
|
39
|
+
readonly "editor:initialize": {
|
|
40
|
+
readonly cardinality: "once";
|
|
41
|
+
readonly replay: "last";
|
|
42
|
+
};
|
|
43
|
+
readonly "editor:unmount": {
|
|
44
|
+
readonly cardinality: "once";
|
|
45
|
+
readonly replay: "last";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
20
48
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
21
49
|
container: HTMLDivElement | null;
|
|
22
50
|
id: string | null;
|
|
23
51
|
}>;
|
|
52
|
+
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
|
|
53
|
+
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
|
|
24
54
|
export declare const useApp: () => AppClassProperties;
|
|
25
55
|
export declare const useAppProps: () => AppProps;
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
canFitSidebar: boolean;
|
|
34
|
-
};
|
|
56
|
+
export declare const useEditorInterface: () => Readonly<{
|
|
57
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
58
|
+
desktopUIMode: "compact" | "full";
|
|
59
|
+
userAgent: Readonly<{
|
|
60
|
+
isMobileDevice: boolean;
|
|
61
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
62
|
+
}>;
|
|
35
63
|
isTouchScreen: boolean;
|
|
64
|
+
canFitSidebar: boolean;
|
|
65
|
+
isLandscape: boolean;
|
|
36
66
|
}>;
|
|
67
|
+
export declare const useStylesPanelMode: () => StylesPanelMode;
|
|
37
68
|
export declare const useExcalidrawContainer: () => {
|
|
38
69
|
container: HTMLDivElement | null;
|
|
39
70
|
id: string | null;
|
|
@@ -42,24 +73,34 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
42
73
|
export declare const useExcalidrawAppState: () => AppState;
|
|
43
74
|
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
75
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
76
|
+
/**
|
|
77
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
78
|
+
*/
|
|
79
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
45
80
|
declare class App extends React.Component<AppProps, AppState> {
|
|
46
81
|
canvas: AppClassProperties["canvas"];
|
|
47
82
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
83
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
48
84
|
rc: RoughCanvas;
|
|
49
85
|
unmounted: boolean;
|
|
50
86
|
actionManager: ActionManager;
|
|
51
|
-
|
|
87
|
+
editorInterface: EditorInterface;
|
|
88
|
+
private stylesPanelMode;
|
|
52
89
|
private excalidrawContainerRef;
|
|
90
|
+
get ownerDocument(): Document;
|
|
91
|
+
get ownerWindow(): Window & typeof globalThis;
|
|
53
92
|
scene: Scene;
|
|
54
93
|
fonts: Fonts;
|
|
55
94
|
renderer: Renderer;
|
|
56
95
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
96
|
+
/** whether the last render had any renderable elements (excludes e.g. the
|
|
97
|
+
* in-progress `newElement` and the edited text element) */
|
|
98
|
+
private hasRenderableElements;
|
|
57
99
|
private resizeObserver;
|
|
58
|
-
private nearestScrollableContainer;
|
|
59
100
|
library: AppClassProperties["library"];
|
|
60
101
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
61
102
|
id: string;
|
|
62
|
-
|
|
103
|
+
store: Store;
|
|
63
104
|
private history;
|
|
64
105
|
excalidrawContainerValue: {
|
|
65
106
|
container: HTMLDivElement | null;
|
|
@@ -78,26 +119,51 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
119
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
79
120
|
* insert to DOM before user initially scrolls to them) */
|
|
80
121
|
private initializedEmbeds;
|
|
81
|
-
private handleToastClose;
|
|
82
122
|
private elementsPendingErasure;
|
|
83
|
-
|
|
84
|
-
private
|
|
123
|
+
private _initialized;
|
|
124
|
+
private readonly editorLifecycleEvents;
|
|
125
|
+
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
126
|
+
private appStateObserver;
|
|
127
|
+
onStateChange: OnStateChange;
|
|
128
|
+
bucketFill: AppBucketFill;
|
|
129
|
+
duplicate: AppDuplicate;
|
|
130
|
+
toolDrag: AppToolDrag;
|
|
131
|
+
flowchart: AppFlowchart;
|
|
132
|
+
cursor: AppCursor;
|
|
133
|
+
arrowText: AppArrowText;
|
|
134
|
+
pan: AppPan;
|
|
135
|
+
viewport: AppViewport;
|
|
136
|
+
wheel: AppWheel;
|
|
137
|
+
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
138
|
+
private textWysiwygSubmitHandler;
|
|
85
139
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
86
140
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
141
|
+
/**
|
|
142
|
+
* the handle of the resize in progress while `state.isResizing` — for UI
|
|
143
|
+
* that words itself by handle (a sticky note's corners resize
|
|
144
|
+
* proportionally, its edges freely); not app state, so it costs no
|
|
145
|
+
* re-render of its own
|
|
146
|
+
*/
|
|
147
|
+
activeResizeHandle: TransformHandleDirection | null;
|
|
87
148
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
149
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
88
150
|
lastPointerMoveEvent: PointerEvent | null;
|
|
151
|
+
/** current frame pointer cords */
|
|
89
152
|
lastPointerMoveCoords: {
|
|
90
153
|
x: number;
|
|
91
154
|
y: number;
|
|
92
155
|
} | null;
|
|
93
|
-
|
|
156
|
+
private lastCompletedCanvasClicks;
|
|
157
|
+
/** previous frame pointer coords */
|
|
158
|
+
previousPointerMoveCoords: {
|
|
94
159
|
x: number;
|
|
95
160
|
y: number;
|
|
96
|
-
};
|
|
97
|
-
|
|
161
|
+
} | null;
|
|
162
|
+
drawShape: AppDrawShape;
|
|
98
163
|
laserTrails: LaserTrails;
|
|
99
164
|
eraserTrail: EraserTrail;
|
|
100
165
|
lassoTrail: LassoTrail;
|
|
166
|
+
cursorHints: CursorHints;
|
|
101
167
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
102
168
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
103
169
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -112,11 +178,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
112
178
|
x: number;
|
|
113
179
|
y: number;
|
|
114
180
|
}>;
|
|
115
|
-
scrollbars:
|
|
116
|
-
isOverEither: boolean;
|
|
117
|
-
isOverHorizontal: boolean;
|
|
118
|
-
isOverVertical: boolean;
|
|
119
|
-
};
|
|
181
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
120
182
|
lastCoords: {
|
|
121
183
|
x: number;
|
|
122
184
|
y: number;
|
|
@@ -129,7 +191,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
129
191
|
x: number;
|
|
130
192
|
y: number;
|
|
131
193
|
};
|
|
132
|
-
arrowDirection: "
|
|
194
|
+
arrowDirection: "origin" | "end";
|
|
133
195
|
center: {
|
|
134
196
|
x: number;
|
|
135
197
|
y: number;
|
|
@@ -141,6 +203,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
141
203
|
wasAddedToSelection: boolean;
|
|
142
204
|
hasBeenDuplicated: boolean;
|
|
143
205
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
206
|
+
arrowLabel: boolean;
|
|
144
207
|
};
|
|
145
208
|
withCmdOrCtrl: boolean;
|
|
146
209
|
drag: {
|
|
@@ -153,16 +216,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
153
216
|
x: number;
|
|
154
217
|
y: number;
|
|
155
218
|
};
|
|
219
|
+
blockDragging: boolean;
|
|
156
220
|
};
|
|
157
221
|
eventListeners: {
|
|
158
|
-
onMove:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
} | null;
|
|
163
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
164
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
165
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
222
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
223
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
224
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
225
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
166
226
|
};
|
|
167
227
|
boxSelection: {
|
|
168
228
|
hasOccurred: boolean;
|
|
@@ -181,11 +241,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
181
241
|
x: number;
|
|
182
242
|
y: number;
|
|
183
243
|
}>;
|
|
184
|
-
scrollbars:
|
|
185
|
-
isOverEither: boolean;
|
|
186
|
-
isOverHorizontal: boolean;
|
|
187
|
-
isOverVertical: boolean;
|
|
188
|
-
};
|
|
244
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
189
245
|
lastCoords: {
|
|
190
246
|
x: number;
|
|
191
247
|
y: number;
|
|
@@ -198,7 +254,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
198
254
|
x: number;
|
|
199
255
|
y: number;
|
|
200
256
|
};
|
|
201
|
-
arrowDirection: "
|
|
257
|
+
arrowDirection: "origin" | "end";
|
|
202
258
|
center: {
|
|
203
259
|
x: number;
|
|
204
260
|
y: number;
|
|
@@ -210,6 +266,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
210
266
|
wasAddedToSelection: boolean;
|
|
211
267
|
hasBeenDuplicated: boolean;
|
|
212
268
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
269
|
+
arrowLabel: boolean;
|
|
213
270
|
};
|
|
214
271
|
withCmdOrCtrl: boolean;
|
|
215
272
|
drag: {
|
|
@@ -222,16 +279,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
222
279
|
x: number;
|
|
223
280
|
y: number;
|
|
224
281
|
};
|
|
282
|
+
blockDragging: boolean;
|
|
225
283
|
};
|
|
226
284
|
eventListeners: {
|
|
227
|
-
onMove:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} | null;
|
|
232
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
233
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
234
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
285
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
286
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
287
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
288
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
235
289
|
};
|
|
236
290
|
boxSelection: {
|
|
237
291
|
hasOccurred: boolean;
|
|
@@ -243,17 +297,107 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
243
297
|
}>]>;
|
|
244
298
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
245
299
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
300
|
+
api: ExcalidrawImperativeAPI;
|
|
301
|
+
private elementRenderOverrides;
|
|
302
|
+
/** offsets of `elementRenderOverrides`; keeps its identity while they don't change */
|
|
303
|
+
private elementRenderOffsets;
|
|
304
|
+
private renderOverridesUpdatePending;
|
|
305
|
+
private getRenderOverrideConfig;
|
|
306
|
+
private getElementRenderState;
|
|
307
|
+
private createExcalidrawAPI;
|
|
246
308
|
constructor(props: AppProps);
|
|
309
|
+
/**
|
|
310
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
311
|
+
* clipboard, drag&drop). When `false`, the editor is fully inert for the
|
|
312
|
+
* user, but remains controllable through the imperative API.
|
|
313
|
+
*
|
|
314
|
+
* All user-input entry points must consult this getter (directly or by
|
|
315
|
+
* not being attached/rendered at all).
|
|
316
|
+
*/
|
|
317
|
+
isInteractionEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Whether element links render their link icon and are clickable.
|
|
320
|
+
* True when fully interactive, or when `interaction: { enabled: { links:
|
|
321
|
+
* true } }`
|
|
322
|
+
* (in which case clicking anywhere on a linked element opens the link,
|
|
323
|
+
* same as in view mode).
|
|
324
|
+
*/
|
|
325
|
+
isLinksEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Whether canvas navigation — panning & zooming, view-mode style — is
|
|
328
|
+
* enabled. True when fully interactive, or when `interaction: { enabled:
|
|
329
|
+
* { navigation: true } }`. Respects `appState.scrollConstraints`.
|
|
330
|
+
*/
|
|
331
|
+
isNavigationEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Whether embeddable & iframe elements are interactive (hover & click to
|
|
334
|
+
* activate, view-mode style). True when fully interactive, or when
|
|
335
|
+
* allowed via `interaction.enabled.embeds` / `.interactiveContent`.
|
|
336
|
+
*/
|
|
337
|
+
isEmbedsEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Whether the browser's own zoom (ctrl/cmd + wheel, pinch, keyboard
|
|
340
|
+
* shortcuts) stays available over the non-interactive editor.
|
|
341
|
+
* Prevented by default.
|
|
342
|
+
*/
|
|
343
|
+
isBrowserZoomEnabled(props?: Pick<AppProps, "interaction">): boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Whether the tool can be activated & driven by user input. False when
|
|
346
|
+
* disabled via `UIOptions.tools`, or when the editor is non-interactive
|
|
347
|
+
* and the tool isn't kept user-driven via `interaction.enabled.tools`.
|
|
348
|
+
*
|
|
349
|
+
* (Once UI tool availability is split from input availability — e.g.
|
|
350
|
+
* `props.ui.tools` vs `interaction.disabled.tools` — the UI axis moves
|
|
351
|
+
* out into its own predicate.)
|
|
352
|
+
*
|
|
353
|
+
* We purposely widen the `tool` type so this helper can be called with
|
|
354
|
+
* any tool without having to type check it.
|
|
355
|
+
*/
|
|
356
|
+
isToolSupported: <T extends ToolType | "custom">(tool: T, props?: Pick<AppProps, "interaction" | "UIOptions">) => boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Whether the active tool is locked in place — via the tool lock
|
|
359
|
+
* (padlock / Q) or by being host-forced (`props.activeTool`). A locked
|
|
360
|
+
* tool doesn't revert to the selection tool after use, and elements drawn
|
|
361
|
+
* with it aren't selected. Forcing deliberately does not mutate
|
|
362
|
+
* `activeTool.locked`, which is the user's persisted padlock preference.
|
|
363
|
+
*/
|
|
364
|
+
isToolLocked(): boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Whether the active tool captures the primary pointer instead of the
|
|
367
|
+
* view-mode drag-to-pan — the laser and host-implemented custom tools do;
|
|
368
|
+
* while non-interactive, any tool allowed via
|
|
369
|
+
* `interaction.enabled.tools` does. (Editing tools capture the pointer
|
|
370
|
+
* trivially since view mode implies they're not active; this predicate only
|
|
371
|
+
* matters where view-mode gates apply.)
|
|
372
|
+
*/
|
|
373
|
+
isActiveToolPointerCapturing(): boolean;
|
|
374
|
+
/** Whether Excalidraw's full default UI is rendered. */
|
|
375
|
+
isDefaultUIEnabled(props?: Pick<AppProps, "ui">): boolean;
|
|
376
|
+
/** Whether an individual default UI control is rendered. */
|
|
377
|
+
isUIControlEnabled(control: keyof UIConfig["enabled"], props?: Pick<AppProps, "ui">): boolean;
|
|
247
378
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
248
379
|
private onWindowMessage;
|
|
380
|
+
private handleSkipBindMode;
|
|
381
|
+
private resetDelayedBindMode;
|
|
382
|
+
private previousHoveredBindableElement;
|
|
383
|
+
private handleDelayedBindModeChange;
|
|
249
384
|
private cacheEmbeddableRef;
|
|
250
385
|
/**
|
|
251
386
|
* Returns gridSize taking into account `gridModeEnabled`.
|
|
252
387
|
* If disabled, returns null.
|
|
253
388
|
*/
|
|
254
389
|
getEffectiveGridSize: () => NullableGridSize;
|
|
390
|
+
private getTextCreationGridPoint;
|
|
255
391
|
private getHTMLIFrameElement;
|
|
256
|
-
|
|
392
|
+
/**
|
|
393
|
+
* AI-generated iframe elements aren't interactive while their generation
|
|
394
|
+
* is still in progress (the partial content is render-only).
|
|
395
|
+
*/
|
|
396
|
+
private isIframeLikeInteractive;
|
|
397
|
+
private handleIframeLikeElementHover;
|
|
398
|
+
/** @returns true if iframe-like element click handled */
|
|
399
|
+
private handleIframeLikeCenterClick;
|
|
400
|
+
private isDoubleClick;
|
|
257
401
|
private isIframeLikeElementCenter;
|
|
258
402
|
private updateEmbedValidationStatus;
|
|
259
403
|
private updateEmbeddables;
|
|
@@ -265,12 +409,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
265
409
|
private toggleOverscrollBehavior;
|
|
266
410
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
267
411
|
focusContainer: AppClassProperties["focusContainer"];
|
|
268
|
-
getSceneElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[];
|
|
269
|
-
getSceneElementsMapIncludingDeleted: () =>
|
|
412
|
+
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
413
|
+
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
|
|
270
414
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
271
415
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
272
416
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
273
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
417
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
274
418
|
}) => Promise<void>;
|
|
275
419
|
private magicGenerations;
|
|
276
420
|
private updateMagicGeneration;
|
|
@@ -286,9 +430,33 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
286
430
|
private openEyeDropper;
|
|
287
431
|
dismissLinearEditor: () => void;
|
|
288
432
|
syncActionResult: (actionResult: ActionResult) => void;
|
|
433
|
+
scheduleCapture: () => void;
|
|
289
434
|
private onBlur;
|
|
290
435
|
private onUnload;
|
|
291
436
|
private disableEvent;
|
|
437
|
+
private handleNavigationModeKeyDown;
|
|
438
|
+
/**
|
|
439
|
+
* PageUp/PageDown scroll the canvas by a page — vertically, or
|
|
440
|
+
* horizontally with shift. Respects `appState.scrollConstraints`
|
|
441
|
+
* (via `viewport.translate`).
|
|
442
|
+
*/
|
|
443
|
+
private maybeHandlePageScrollKeyDown;
|
|
444
|
+
private preventBrowserZoomKeyDown;
|
|
445
|
+
/** Ends active input sessions before switching to a view-mode/non-interactive
|
|
446
|
+
* mode. */
|
|
447
|
+
private terminateActiveInteraction;
|
|
448
|
+
private handleInteractionStateChange;
|
|
449
|
+
/** whether the two values reference the same tool (incl. custom subtype) */
|
|
450
|
+
private isSameForcedTool;
|
|
451
|
+
/**
|
|
452
|
+
* Keeps `state.activeTool` synced to the host-controlled
|
|
453
|
+
* `props.activeTool`. `setActiveTool` refuses non-matching activations
|
|
454
|
+
* while forced (user input, API); this backstop covers the writers that
|
|
455
|
+
* bypass the funnel (`actionFinalize`/`actionDeselect`, `restore()` on
|
|
456
|
+
* scene load, ...) and re-applies the tool once it becomes activatable
|
|
457
|
+
* (e.g. `interaction` config changes).
|
|
458
|
+
*/
|
|
459
|
+
private handleForcedToolChange;
|
|
292
460
|
private resetHistory;
|
|
293
461
|
private resetStore;
|
|
294
462
|
/**
|
|
@@ -297,9 +465,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
297
465
|
*/
|
|
298
466
|
private resetScene;
|
|
299
467
|
private initializeScene;
|
|
300
|
-
private
|
|
301
|
-
|
|
302
|
-
private
|
|
468
|
+
private getFormFactor;
|
|
469
|
+
refreshEditorInterface: () => void;
|
|
470
|
+
private reconcileStylesPanelMode;
|
|
471
|
+
/** TO BE USED LATER */
|
|
472
|
+
private setDesktopUIMode;
|
|
303
473
|
private clearImageShapeCache;
|
|
304
474
|
componentDidMount(): Promise<void>;
|
|
305
475
|
componentWillUnmount(): void;
|
|
@@ -316,6 +486,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
316
486
|
private static resetTapTwice;
|
|
317
487
|
private onTouchStart;
|
|
318
488
|
private onTouchEnd;
|
|
489
|
+
private insertClipboardContent;
|
|
319
490
|
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
320
491
|
addElementsFromPasteOrLibrary: (opts: {
|
|
321
492
|
elements: readonly ExcalidrawElement[];
|
|
@@ -325,54 +496,25 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
325
496
|
clientY: number;
|
|
326
497
|
} | "cursor" | "center";
|
|
327
498
|
retainSeed?: boolean;
|
|
328
|
-
|
|
499
|
+
fit?: SetViewportOptions["fit"];
|
|
500
|
+
preserveFrameChildrenOrder?: boolean;
|
|
329
501
|
}) => void;
|
|
330
502
|
private addElementsFromMixedContentPaste;
|
|
331
503
|
private addTextFromPaste;
|
|
332
504
|
setAppState: React.Component<any, AppState>["setState"];
|
|
333
505
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
334
506
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
335
|
-
updateFrameRendering: (opts: Partial<
|
|
336
|
-
enabled: boolean;
|
|
337
|
-
name: boolean;
|
|
338
|
-
outline: boolean;
|
|
339
|
-
clip: boolean;
|
|
340
|
-
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
507
|
+
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
341
508
|
togglePenMode: (force: boolean | null) => void;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
*
|
|
345
|
-
*/
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
viewportZoomFactor?: number;
|
|
352
|
-
animate?: boolean;
|
|
353
|
-
duration?: number;
|
|
354
|
-
} | {
|
|
355
|
-
fitToContent?: never;
|
|
356
|
-
fitToViewport?: boolean;
|
|
357
|
-
/** when fitToViewport=true, how much screen should the content cover,
|
|
358
|
-
* between 0.1 (10%) and 1 (100%)
|
|
359
|
-
*/
|
|
360
|
-
viewportZoomFactor?: number;
|
|
361
|
-
animate?: boolean;
|
|
362
|
-
duration?: number;
|
|
363
|
-
}) & {
|
|
364
|
-
minZoom?: number;
|
|
365
|
-
maxZoom?: number;
|
|
366
|
-
canvasOffsets?: Offsets;
|
|
367
|
-
}) => void;
|
|
368
|
-
private maybeUnfollowRemoteUser;
|
|
369
|
-
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
370
|
-
private translateCanvas;
|
|
371
|
-
setToast: (toast: {
|
|
372
|
-
message: string;
|
|
373
|
-
closable?: boolean;
|
|
374
|
-
duration?: number;
|
|
375
|
-
} | null) => void;
|
|
509
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
510
|
+
/** emits a follow/unfollow intent to the host (which owns the
|
|
511
|
+
* `userToFollow` state) via both the `onUserFollow` prop and the
|
|
512
|
+
* imperative API emitter */
|
|
513
|
+
emitUserFollowIntent: (payload: OnUserFollowedPayload) => void;
|
|
514
|
+
/** emits an UNFOLLOW intent if currently following someone — use on
|
|
515
|
+
* user-initiated viewport changes which should break follow mode */
|
|
516
|
+
requestUnfollow: () => void;
|
|
517
|
+
setToast: (toast: AppState["toast"]) => void;
|
|
376
518
|
restoreFileFromShare: () => Promise<void>;
|
|
377
519
|
/**
|
|
378
520
|
* adds supplied files to existing files in the appState.
|
|
@@ -382,7 +524,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
382
524
|
private addMissingFiles;
|
|
383
525
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
384
526
|
elements?: SceneData["elements"];
|
|
385
|
-
appState?: Pick<AppState, K> | null
|
|
527
|
+
appState?: Pick<AppState, K> | null;
|
|
386
528
|
collaborators?: SceneData["collaborators"];
|
|
387
529
|
/**
|
|
388
530
|
* 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.
|
|
@@ -397,22 +539,26 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
397
539
|
*/
|
|
398
540
|
captureUpdate?: SceneData["captureUpdate"];
|
|
399
541
|
}) => void;
|
|
542
|
+
/**
|
|
543
|
+
* see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details
|
|
544
|
+
*/
|
|
545
|
+
setElementRenderOverrides: (overrides: ElementRenderOverrides | null) => void;
|
|
400
546
|
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
401
547
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
402
|
-
|
|
548
|
+
triggerRender: (
|
|
549
|
+
/** force always re-renders canvas even if no change */
|
|
550
|
+
force?: boolean) => void;
|
|
403
551
|
/**
|
|
404
552
|
* @returns whether the menu was toggled on or off
|
|
405
553
|
*/
|
|
406
554
|
toggleSidebar: ({ name, tab, force, }: {
|
|
407
555
|
name: SidebarName | null;
|
|
408
|
-
tab?:
|
|
409
|
-
force?: boolean
|
|
556
|
+
tab?: SidebarTabName;
|
|
557
|
+
force?: boolean;
|
|
410
558
|
}) => boolean;
|
|
411
559
|
private updateCurrentCursorPosition;
|
|
412
|
-
getEditorUIOffsets: () => Offsets;
|
|
413
560
|
private onKeyDown;
|
|
414
561
|
private onKeyUp;
|
|
415
|
-
private isToolSupported;
|
|
416
562
|
setActiveTool: (tool: ({
|
|
417
563
|
type: ToolType;
|
|
418
564
|
} | {
|
|
@@ -421,10 +567,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
421
567
|
}) & {
|
|
422
568
|
locked?: boolean;
|
|
423
569
|
fromSelection?: boolean;
|
|
424
|
-
},
|
|
570
|
+
}, opts?: {
|
|
571
|
+
keepSelection?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
574
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
575
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
576
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
577
|
+
* activation can switch back to it).
|
|
578
|
+
*/
|
|
579
|
+
toggle?: boolean;
|
|
580
|
+
}) => void;
|
|
425
581
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
426
|
-
private setCursor;
|
|
427
|
-
private resetCursor;
|
|
428
582
|
/**
|
|
429
583
|
* returns whether user is making a gesture with >= 2 fingers (points)
|
|
430
584
|
* on o touch screen (not on a trackpad). Currently only relates to Darwin
|
|
@@ -438,22 +592,297 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
438
592
|
private onGestureEnd;
|
|
439
593
|
private handleTextWysiwyg;
|
|
440
594
|
private deselectElements;
|
|
441
|
-
private
|
|
442
|
-
private
|
|
443
|
-
|
|
595
|
+
private getSelectedTextElement;
|
|
596
|
+
private getSelectedTextEditingContainerAtPosition;
|
|
597
|
+
getTextElementAtPosition(x: number, y: number): NonDeleted<ExcalidrawTextElement> | null;
|
|
598
|
+
private isHittingTextAutoResizeHandle;
|
|
599
|
+
private handleTextAutoResizeHandlePointerDown;
|
|
600
|
+
getElementAtPosition(x: number, y: number, opts?: ({
|
|
601
|
+
includeBoundTextElement?: boolean;
|
|
602
|
+
includeLockedElements?: boolean;
|
|
603
|
+
} | {
|
|
604
|
+
allHitElements: NonDeleted<ExcalidrawElement>[];
|
|
605
|
+
}) & {
|
|
606
|
+
preferSelected?: boolean;
|
|
607
|
+
}): NonDeleted<ExcalidrawElement> | null;
|
|
608
|
+
getElementsAtPosition(x: number, y: number, opts?: {
|
|
609
|
+
includeBoundTextElement?: boolean;
|
|
610
|
+
includeLockedElements?: boolean;
|
|
611
|
+
}): NonDeleted<ExcalidrawElement>[];
|
|
444
612
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
613
|
+
hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
|
|
614
|
+
getTextBindableContainerAtPosition(x: number, y: number): (Readonly<{
|
|
615
|
+
id: string;
|
|
616
|
+
x: number;
|
|
617
|
+
y: number;
|
|
618
|
+
strokeColor: string;
|
|
619
|
+
backgroundColor: string;
|
|
620
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
621
|
+
strokeWidth: number;
|
|
622
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
623
|
+
roundness: null | {
|
|
624
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
625
|
+
value?: number;
|
|
626
|
+
};
|
|
627
|
+
roughness: number;
|
|
628
|
+
opacity: number;
|
|
629
|
+
width: number;
|
|
630
|
+
height: number;
|
|
631
|
+
angle: Radians;
|
|
632
|
+
seed: number;
|
|
633
|
+
version: number;
|
|
634
|
+
versionNonce: number;
|
|
635
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
636
|
+
isDeleted: boolean;
|
|
637
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
638
|
+
frameId: string | null;
|
|
639
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
640
|
+
updated: number;
|
|
641
|
+
created: number | null;
|
|
642
|
+
link: string | null;
|
|
643
|
+
locked: boolean;
|
|
644
|
+
customData?: Record<string, any>;
|
|
645
|
+
}> & {
|
|
646
|
+
type: "rectangle";
|
|
647
|
+
} & {
|
|
648
|
+
isDeleted: false;
|
|
649
|
+
}) | (Readonly<{
|
|
650
|
+
id: string;
|
|
651
|
+
x: number;
|
|
652
|
+
y: number;
|
|
653
|
+
strokeColor: string;
|
|
654
|
+
backgroundColor: string;
|
|
655
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
656
|
+
strokeWidth: number;
|
|
657
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
658
|
+
roundness: null | {
|
|
659
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
660
|
+
value?: number;
|
|
661
|
+
};
|
|
662
|
+
roughness: number;
|
|
663
|
+
opacity: number;
|
|
664
|
+
width: number;
|
|
665
|
+
height: number;
|
|
666
|
+
angle: Radians;
|
|
667
|
+
seed: number;
|
|
668
|
+
version: number;
|
|
669
|
+
versionNonce: number;
|
|
670
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
671
|
+
isDeleted: boolean;
|
|
672
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
673
|
+
frameId: string | null;
|
|
674
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
675
|
+
updated: number;
|
|
676
|
+
created: number | null;
|
|
677
|
+
link: string | null;
|
|
678
|
+
locked: boolean;
|
|
679
|
+
customData?: Record<string, any>;
|
|
680
|
+
}> & Readonly<{
|
|
681
|
+
type: "stickynote";
|
|
682
|
+
baseHeight: number;
|
|
683
|
+
}> & {
|
|
684
|
+
isDeleted: false;
|
|
685
|
+
}) | (Readonly<{
|
|
686
|
+
id: string;
|
|
687
|
+
x: number;
|
|
688
|
+
y: number;
|
|
689
|
+
strokeColor: string;
|
|
690
|
+
backgroundColor: string;
|
|
691
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
692
|
+
strokeWidth: number;
|
|
693
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
694
|
+
roundness: null | {
|
|
695
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
696
|
+
value?: number;
|
|
697
|
+
};
|
|
698
|
+
roughness: number;
|
|
699
|
+
opacity: number;
|
|
700
|
+
width: number;
|
|
701
|
+
height: number;
|
|
702
|
+
angle: Radians;
|
|
703
|
+
seed: number;
|
|
704
|
+
version: number;
|
|
705
|
+
versionNonce: number;
|
|
706
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
707
|
+
isDeleted: boolean;
|
|
708
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
709
|
+
frameId: string | null;
|
|
710
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
711
|
+
updated: number;
|
|
712
|
+
created: number | null;
|
|
713
|
+
link: string | null;
|
|
714
|
+
locked: boolean;
|
|
715
|
+
customData?: Record<string, any>;
|
|
716
|
+
}> & {
|
|
717
|
+
type: "diamond";
|
|
718
|
+
} & {
|
|
719
|
+
isDeleted: false;
|
|
720
|
+
}) | (Readonly<{
|
|
721
|
+
id: string;
|
|
722
|
+
x: number;
|
|
723
|
+
y: number;
|
|
724
|
+
strokeColor: string;
|
|
725
|
+
backgroundColor: string;
|
|
726
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
727
|
+
strokeWidth: number;
|
|
728
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
729
|
+
roundness: null | {
|
|
730
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
731
|
+
value?: number;
|
|
732
|
+
};
|
|
733
|
+
roughness: number;
|
|
734
|
+
opacity: number;
|
|
735
|
+
width: number;
|
|
736
|
+
height: number;
|
|
737
|
+
angle: Radians;
|
|
738
|
+
seed: number;
|
|
739
|
+
version: number;
|
|
740
|
+
versionNonce: number;
|
|
741
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
742
|
+
isDeleted: boolean;
|
|
743
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
744
|
+
frameId: string | null;
|
|
745
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
746
|
+
updated: number;
|
|
747
|
+
created: number | null;
|
|
748
|
+
link: string | null;
|
|
749
|
+
locked: boolean;
|
|
750
|
+
customData?: Record<string, any>;
|
|
751
|
+
}> & {
|
|
752
|
+
type: "ellipse";
|
|
753
|
+
} & {
|
|
754
|
+
isDeleted: false;
|
|
755
|
+
}) | (Readonly<{
|
|
756
|
+
id: string;
|
|
757
|
+
x: number;
|
|
758
|
+
y: number;
|
|
759
|
+
strokeColor: string;
|
|
760
|
+
backgroundColor: string;
|
|
761
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
762
|
+
strokeWidth: number;
|
|
763
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
764
|
+
roundness: null | {
|
|
765
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
766
|
+
value?: number;
|
|
767
|
+
};
|
|
768
|
+
roughness: number;
|
|
769
|
+
opacity: number;
|
|
770
|
+
width: number;
|
|
771
|
+
height: number;
|
|
772
|
+
angle: Radians;
|
|
773
|
+
seed: number;
|
|
774
|
+
version: number;
|
|
775
|
+
versionNonce: number;
|
|
776
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
777
|
+
isDeleted: boolean;
|
|
778
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
779
|
+
frameId: string | null;
|
|
780
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
781
|
+
updated: number;
|
|
782
|
+
created: number | null;
|
|
783
|
+
link: string | null;
|
|
784
|
+
locked: boolean;
|
|
785
|
+
customData?: Record<string, any>;
|
|
786
|
+
}> & Readonly<{
|
|
787
|
+
type: "line" | "arrow";
|
|
788
|
+
points: readonly LocalPoint[];
|
|
789
|
+
startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
790
|
+
endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
791
|
+
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
792
|
+
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
793
|
+
}> & Readonly<{
|
|
794
|
+
type: "arrow";
|
|
795
|
+
elbowed: boolean;
|
|
796
|
+
}> & {
|
|
797
|
+
isDeleted: false;
|
|
798
|
+
}) | null;
|
|
799
|
+
/**
|
|
800
|
+
* Whether a text element's content is still being authored.
|
|
801
|
+
*
|
|
802
|
+
* Creating a text reverts the tool to selection during pointerdown, so the
|
|
803
|
+
* pointerup that follows looks like an ordinary canvas click and would
|
|
804
|
+
* capture the still-empty element as a history entry of its own. Undo would
|
|
805
|
+
* then rewind only the typing, restoring an invisible, zero-content element
|
|
806
|
+
* (and, for an endpoint label, leaving the arrow bound to it) rather than
|
|
807
|
+
* removing it. The editor's own submit captures the finished text instead,
|
|
808
|
+
* so the whole create-and-type lands in a single entry.
|
|
809
|
+
*/
|
|
810
|
+
private isEditingTextContent;
|
|
811
|
+
startTextEditing: ({ sceneX, sceneY, insertAtParentCenter, container, autoEdit, initialCaretSceneCoords, arrowEndpoint, }: {
|
|
812
|
+
/** X position to insert text at */
|
|
813
|
+
sceneX: number;
|
|
814
|
+
/** Y position to insert text at */
|
|
815
|
+
sceneY: number;
|
|
816
|
+
/** whether to attempt to insert at element center if applicable */
|
|
817
|
+
insertAtParentCenter?: boolean;
|
|
818
|
+
container?: ExcalidrawTextContainer | null;
|
|
819
|
+
autoEdit?: boolean;
|
|
820
|
+
initialCaretSceneCoords?: {
|
|
821
|
+
x: number;
|
|
822
|
+
y: number;
|
|
823
|
+
};
|
|
824
|
+
/**
|
|
825
|
+
* creates the text as a label for this arrow endpoint: the binding then
|
|
826
|
+
* dictates the text's position and alignment, overriding (sceneX, sceneY)
|
|
827
|
+
*/
|
|
828
|
+
arrowEndpoint?: ArrowEndpoint | null;
|
|
829
|
+
}) => void;
|
|
448
830
|
private startImageCropping;
|
|
449
831
|
private finishImageCropping;
|
|
832
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
450
833
|
private handleCanvasDoubleClick;
|
|
834
|
+
private handleCanvasClick;
|
|
451
835
|
private getElementLinkAtPosition;
|
|
452
|
-
private
|
|
453
|
-
|
|
836
|
+
private handleElementLinkClick;
|
|
837
|
+
/**
|
|
838
|
+
* Applies (or clears) the element-link hover affordances — pointer cursor
|
|
839
|
+
* and tooltip — based on the current `hitLinkElement`. Returns whether a
|
|
840
|
+
* link is being hovered.
|
|
841
|
+
*/
|
|
842
|
+
private applyElementLinkHoverAffordance;
|
|
843
|
+
/**
|
|
844
|
+
* On touchscreens (where no hover precedes the tap) re-derives
|
|
845
|
+
* `hitLinkElement`, then opens the hit element link, if any.
|
|
846
|
+
* Returns whether a link click was handled.
|
|
847
|
+
*/
|
|
848
|
+
private maybeHandleElementLinkClick;
|
|
849
|
+
/**
|
|
850
|
+
* Restricted pointer handling for the non-interactive editor with links
|
|
851
|
+
* and/or embeds allowed (`interaction.enabled.links` / `.embeds` /
|
|
852
|
+
* `.interactiveContent`) — runs only the element-link & embed concerns
|
|
853
|
+
* (shared with the full pointer handlers above) so they behave like in
|
|
854
|
+
* view mode without the rest of the canvas pointer machinery.
|
|
855
|
+
*/
|
|
856
|
+
private handleInteractiveContentPointerMove;
|
|
857
|
+
private handleInteractiveContentPointerUp;
|
|
858
|
+
/**
|
|
859
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
860
|
+
* inside frames)
|
|
861
|
+
*/
|
|
862
|
+
getTopLayerFrameAtSceneCoords: (
|
|
863
|
+
/**
|
|
864
|
+
* should be already grid aligned (basically should be what the call site
|
|
865
|
+
* sets the element's coords to, if applicable)
|
|
866
|
+
*/
|
|
867
|
+
sceneCoords: {
|
|
868
|
+
x: number;
|
|
869
|
+
y: number;
|
|
870
|
+
}, opts?: {
|
|
871
|
+
/** to exclude selected elements when dragging, etc. */
|
|
872
|
+
excludeElementIds?: AppState["selectedElementIds"];
|
|
873
|
+
currentFrameId?: ExcalidrawElement["frameId"];
|
|
874
|
+
}) => NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
875
|
+
private updateFrameToHighlight;
|
|
876
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
877
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
878
|
+
insertNewElement: (element: ExcalidrawElement) => void;
|
|
454
879
|
private handleCanvasPointerMove;
|
|
455
880
|
private handleEraser;
|
|
456
881
|
private handleTouchMove;
|
|
882
|
+
/**
|
|
883
|
+
* Applies the hover affordances of a selected linear element: the cursor,
|
|
884
|
+
* plus the hovered-handle state that renders them highlighted.
|
|
885
|
+
*/
|
|
457
886
|
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
|
|
458
887
|
private handleCanvasPointerDown;
|
|
459
888
|
private handleCanvasPointerUp;
|
|
@@ -465,8 +894,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
465
894
|
* pointerup handlers manually
|
|
466
895
|
*/
|
|
467
896
|
private maybeCleanupAfterMissingPointerUp;
|
|
468
|
-
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
|
|
469
897
|
private updateGestureOnPointerDown;
|
|
898
|
+
/**
|
|
899
|
+
* Tracks the pointer within the ongoing multi-touch gesture and applies
|
|
900
|
+
* the two-finger pinch zoom/pan, if any.
|
|
901
|
+
*/
|
|
902
|
+
private updateMultiTouchGesture;
|
|
470
903
|
private initialPointerDownState;
|
|
471
904
|
private handleDraggingScrollBar;
|
|
472
905
|
private clearSelectionIfNotUsingSelection;
|
|
@@ -489,13 +922,16 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
489
922
|
sceneY: number;
|
|
490
923
|
link: string;
|
|
491
924
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
492
|
-
private
|
|
925
|
+
private newImagePlaceholder;
|
|
493
926
|
private handleLinearElementOnPointerDown;
|
|
494
|
-
|
|
927
|
+
getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
|
|
928
|
+
type: 2 | 3;
|
|
929
|
+
} | null;
|
|
930
|
+
getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
|
|
495
931
|
private createGenericElementOnPointerDown;
|
|
496
932
|
private createFrameElementOnPointerDown;
|
|
497
|
-
|
|
498
|
-
|
|
933
|
+
maybeCacheReferenceSnapPoints(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
934
|
+
maybeCacheVisibleGaps(event: KeyboardModifiersObject, selectedElements: readonly NonDeletedExcalidrawElement[], recomputeAnyways?: boolean): void;
|
|
499
935
|
private onKeyDownFromPointerDownHandler;
|
|
500
936
|
private onKeyUpFromPointerDownHandler;
|
|
501
937
|
private onPointerMoveFromPointerDownHandler;
|
|
@@ -510,11 +946,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
510
946
|
* and when you don't want to loose those modifications
|
|
511
947
|
*/
|
|
512
948
|
private getLatestInitializedImageElement;
|
|
513
|
-
|
|
514
|
-
* inserts image into elements array and rerenders
|
|
515
|
-
*/
|
|
516
|
-
private insertImageElement;
|
|
517
|
-
private onImageAction;
|
|
949
|
+
private onImageToolbarButtonClick;
|
|
518
950
|
private getImageNaturalDimensions;
|
|
519
951
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
520
952
|
to error for images that fail during <img> element creation */
|
|
@@ -524,24 +956,39 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
524
956
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
525
957
|
* to render new images. This is just a failsafe */
|
|
526
958
|
private scheduleImageRefresh;
|
|
527
|
-
private updateBindingEnabledOnPointerMove;
|
|
528
|
-
private maybeSuggestBindingAtCursor;
|
|
529
959
|
private clearSelection;
|
|
530
960
|
private handleInteractiveCanvasRef;
|
|
961
|
+
private insertImages;
|
|
531
962
|
private handleAppOnDrop;
|
|
532
|
-
loadFileToCanvas: (file: File, fileHandle:
|
|
963
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
|
|
533
964
|
private handleCanvasContextMenu;
|
|
965
|
+
/** opens the context menu for the element under the pointer, or the canvas */
|
|
966
|
+
openContextMenu: (pointer: {
|
|
967
|
+
clientX: number;
|
|
968
|
+
clientY: number;
|
|
969
|
+
button?: number;
|
|
970
|
+
pointerType?: string;
|
|
971
|
+
}) => void;
|
|
534
972
|
private maybeDragNewGenericElement;
|
|
535
973
|
private maybeHandleCrop;
|
|
536
974
|
private maybeHandleResize;
|
|
537
975
|
private getContextMenuItems;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
976
|
+
getTextWysiwygSnappedToCenterPosition(x: number, y: number, appState: AppState, container?: ExcalidrawTextContainer | null): {
|
|
977
|
+
viewportX: number;
|
|
978
|
+
viewportY: number;
|
|
979
|
+
elementCenterX: number;
|
|
980
|
+
elementCenterY: number;
|
|
981
|
+
} | undefined;
|
|
982
|
+
savePointer: (x: number, y: number, button: "up" | "down") => void;
|
|
983
|
+
resetShouldCacheIgnoreZoomDebounced: {
|
|
984
|
+
(): void;
|
|
985
|
+
flush(): void;
|
|
986
|
+
cancel(): void;
|
|
987
|
+
};
|
|
542
988
|
private updateDOMRect;
|
|
543
989
|
refresh: () => void;
|
|
544
990
|
private getCanvasOffsets;
|
|
991
|
+
watchState: () => void;
|
|
545
992
|
private updateLanguage;
|
|
546
993
|
}
|
|
547
994
|
declare global {
|
|
@@ -551,6 +998,7 @@ declare global {
|
|
|
551
998
|
elements: readonly ExcalidrawElement[];
|
|
552
999
|
state: AppState;
|
|
553
1000
|
setState: React.Component<any, AppState>["setState"];
|
|
1001
|
+
watchState: (prev: any, next: any) => void | undefined;
|
|
554
1002
|
app: InstanceType<typeof App>;
|
|
555
1003
|
history: History;
|
|
556
1004
|
store: Store;
|