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