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