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