@excalidraw/math 0.18.0-0fc927cb4 → 0.18.0-1118751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +363 -163
- 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 +100 -33
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +5 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +47 -77
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +12 -8
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +30 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +77 -51
- package/dist/types/element/src/bounds.d.ts +26 -19
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +11 -3
- package/dist/types/element/src/comparisons.d.ts +10 -7
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +25 -3
- package/dist/types/element/src/distribute.d.ts +3 -2
- package/dist/types/element/src/dragElements.d.ts +30 -3
- package/dist/types/element/src/duplicate.d.ts +67 -6
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +11 -7
- package/dist/types/element/src/fractionalIndex.d.ts +4 -4
- package/dist/types/element/src/frame.d.ts +16 -11
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +10 -4
- package/dist/types/element/src/linearElementEditor.d.ts +48 -30
- package/dist/types/element/src/mutateElement.d.ts +6 -2
- package/dist/types/element/src/newElement.d.ts +44 -8
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +23 -12
- package/dist/types/element/src/resizeElements.d.ts +12 -12
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +14 -14
- package/dist/types/element/src/shape.d.ts +36 -9
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/store.d.ts +3 -2
- package/dist/types/element/src/textElement.d.ts +15 -11
- package/dist/types/element/src/textMeasurements.d.ts +1 -3
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +27 -8
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +30 -31
- package/dist/types/element/src/types.d.ts +55 -20
- package/dist/types/element/src/utils.d.ts +22 -6
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +224 -219
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +134 -131
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +488 -1563
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +161 -899
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +65 -64
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +210 -208
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +171 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +72 -77
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +133 -130
- package/dist/types/excalidraw/actions/actionExport.d.ts +212 -1414
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +336 -504
- package/dist/types/excalidraw/actions/actionGroup.d.ts +144 -149
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +212 -197
- package/dist/types/excalidraw/actions/actionLink.d.ts +78 -77
- package/dist/types/excalidraw/actions/actionMenu.d.ts +67 -438
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +222 -2533
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +72 -75
- package/dist/types/excalidraw/actions/actionStyles.d.ts +66 -64
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +187 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +80 -80
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +187 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +79 -78
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +68 -74
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +78 -77
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +79 -78
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +79 -78
- 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 +56 -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 +33 -11
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +583 -135
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +54 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -4
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
- package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +2 -3
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +10 -4
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/dist/types/excalidraw/components/icons.d.ts +56 -22
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +25 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +357 -12
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
- package/dist/types/excalidraw/data/index.d.ts +8 -9
- package/dist/types/excalidraw/data/json.d.ts +184 -3
- package/dist/types/excalidraw/data/library.d.ts +25 -10
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +25 -10
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +16 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
- package/dist/types/excalidraw/scene/Renderer.d.ts +491 -19
- package/dist/types/excalidraw/scene/export.d.ts +4 -4
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +28 -8
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +12 -12
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +629 -58
- package/dist/types/excalidraw/viewport.d.ts +281 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +8 -5
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +8 -2
- package/dist/types/math/src/polygon.d.ts +26 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +10 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +9 -8
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +8 -8
- package/package.json +2 -2
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -185
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
- package/dist/types/excalidraw/components/shapes.d.ts +0 -62
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@excalidraw/common";
|
|
2
|
-
import type { SuggestedBinding } from "@excalidraw/element";
|
|
1
|
+
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface, StrokeWidthKey } from "@excalidraw/common";
|
|
3
2
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
3
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement,
|
|
4
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, ExcalidrawArrowElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode, ExcalidrawTextElement, StrokeVariability } from "@excalidraw/element/types";
|
|
6
5
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
|
-
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
6
|
+
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement, OnDuplicateData } from "@excalidraw/element";
|
|
7
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
8
8
|
import type { Action } from "./actions/types";
|
|
9
9
|
import type { Spreadsheet } from "./charts";
|
|
10
10
|
import type { ClipboardData } from "./clipboard";
|
|
11
11
|
import type App from "./components/App";
|
|
12
12
|
import type Library from "./data/library";
|
|
13
|
-
import type { FileSystemHandle } from "./data/filesystem";
|
|
14
13
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
15
14
|
import type { SnapLine } from "./snapping";
|
|
16
15
|
import type { ImportedDataState } from "./data/types";
|
|
16
|
+
import type { SetViewportOptions } from "./viewport";
|
|
17
17
|
import type { Language } from "./i18n";
|
|
18
18
|
import type { isOverScrollBars } from "./scene/scrollbars";
|
|
19
19
|
import type React from "react";
|
|
20
20
|
import type { JSX } from "react";
|
|
21
|
+
export type { App };
|
|
21
22
|
export type SocketId = string & {
|
|
22
23
|
_brand: "SocketId";
|
|
23
24
|
};
|
|
@@ -84,7 +85,7 @@ export type BinaryFileData = {
|
|
|
84
85
|
};
|
|
85
86
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
86
87
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
87
|
-
export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
|
|
88
|
+
export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "stickynote" | "embeddable" | "laser" | "autoshape" | "bucketfill";
|
|
88
89
|
export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
|
|
89
90
|
export type ActiveTool = {
|
|
90
91
|
type: ToolType;
|
|
@@ -125,16 +126,22 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
125
126
|
frameRendering: AppState["frameRendering"];
|
|
126
127
|
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
|
|
127
128
|
hoveredElementIds: AppState["hoveredElementIds"];
|
|
129
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
128
130
|
croppingElementId: AppState["croppingElementId"];
|
|
129
131
|
}>;
|
|
130
132
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
133
|
+
activeTool: AppState["activeTool"];
|
|
131
134
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
132
135
|
selectionElement: AppState["selectionElement"];
|
|
133
136
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
134
137
|
selectedLinearElement: AppState["selectedLinearElement"];
|
|
135
138
|
multiElement: AppState["multiElement"];
|
|
139
|
+
newElement: AppState["newElement"];
|
|
136
140
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
137
|
-
|
|
141
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
142
|
+
gridModeEnabled: AppState["gridModeEnabled"];
|
|
143
|
+
suggestedBinding: AppState["suggestedBinding"];
|
|
144
|
+
hoveredArrowTextAnchor: AppState["hoveredArrowTextAnchor"];
|
|
138
145
|
isRotating: AppState["isRotating"];
|
|
139
146
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
140
147
|
collaborators: AppState["collaborators"];
|
|
@@ -145,6 +152,11 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
145
152
|
croppingElementId: AppState["croppingElementId"];
|
|
146
153
|
searchMatches: AppState["searchMatches"];
|
|
147
154
|
activeLockedId: AppState["activeLockedId"];
|
|
155
|
+
hoveredElementIds: AppState["hoveredElementIds"];
|
|
156
|
+
frameRendering: AppState["frameRendering"];
|
|
157
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
158
|
+
exportScale: AppState["exportScale"];
|
|
159
|
+
currentItemArrowType: AppState["currentItemArrowType"];
|
|
148
160
|
}>;
|
|
149
161
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
150
162
|
export type ObservedStandaloneAppState = {
|
|
@@ -163,6 +175,47 @@ export type ObservedElementsAppState = {
|
|
|
163
175
|
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
164
176
|
activeLockedId: AppState["activeLockedId"];
|
|
165
177
|
};
|
|
178
|
+
export type BoxSelectionMode = "contain" | "overlap";
|
|
179
|
+
/**
|
|
180
|
+
* The pointing device the wheel mappings are tuned for. `auto` is reserved
|
|
181
|
+
* for detecting it from the wheel events; see `resolveInputDevice`.
|
|
182
|
+
*/
|
|
183
|
+
export type InputDevice = "auto" | "mouse" | "trackpad";
|
|
184
|
+
/**
|
|
185
|
+
* A box, in scene coordinates, that pan & zoom are constrained to.
|
|
186
|
+
*
|
|
187
|
+
* This is a private type. For public API, only use specific properties,
|
|
188
|
+
* needed.
|
|
189
|
+
*/
|
|
190
|
+
export type ScrollConstraints = {
|
|
191
|
+
x: number;
|
|
192
|
+
y: number;
|
|
193
|
+
width: number;
|
|
194
|
+
height: number;
|
|
195
|
+
/** when set, panning is constrained so the viewport stays within the box */
|
|
196
|
+
lockScroll: boolean;
|
|
197
|
+
/** when set, the viewport cannot zoom out below `zoom` */
|
|
198
|
+
lockZoom: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* The zoom resolved after the `setViewport` navigation settled.
|
|
201
|
+
*/
|
|
202
|
+
zoom: number;
|
|
203
|
+
/**
|
|
204
|
+
* Pixel amount the viewport may overscroll past its resting clamp before
|
|
205
|
+
* snapping back (rubberband). Screen pixels, zoom-independent. Resolved
|
|
206
|
+
* from `lock.overscroll` at the time the lock was installed (`true` →
|
|
207
|
+
* default give, `false` → 0).
|
|
208
|
+
*/
|
|
209
|
+
overscroll: number;
|
|
210
|
+
/**
|
|
211
|
+
* Extra scrollable margin around the box (CSS-style), letting the viewport
|
|
212
|
+
* scroll past each box edge to reveal that much empty space. Values are
|
|
213
|
+
* viewport pixels and zoom-independent (a fixed on-screen distance).
|
|
214
|
+
* Resolved from the `offsets` passed to `setViewport` (see
|
|
215
|
+
* {@link ViewportOffsets}) at the time the lock was installed.
|
|
216
|
+
*/
|
|
217
|
+
offsets?: Offsets;
|
|
218
|
+
};
|
|
166
219
|
export interface AppState {
|
|
167
220
|
contextMenu: {
|
|
168
221
|
items: ContextMenuItems;
|
|
@@ -196,9 +249,42 @@ export interface AppState {
|
|
|
196
249
|
* - set on pointer down, updated during pointer move
|
|
197
250
|
*/
|
|
198
251
|
selectionElement: NonDeletedExcalidrawElement | null;
|
|
252
|
+
/**
|
|
253
|
+
* tracking current arrow binding editor state (takes into account
|
|
254
|
+
* `bindingPreference` and keyboard modifiers (ctrl/alt)
|
|
255
|
+
*/
|
|
199
256
|
isBindingEnabled: boolean;
|
|
200
|
-
|
|
201
|
-
|
|
257
|
+
/** user box selection preference; defaults to "contain" when unset */
|
|
258
|
+
boxSelectionMode: BoxSelectionMode;
|
|
259
|
+
/** user arrow binding preference */
|
|
260
|
+
bindingPreference: "enabled" | "disabled";
|
|
261
|
+
/** user preference whether arrow snap to midpoints while binding */
|
|
262
|
+
isMidpointSnappingEnabled: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* user preference for what the wheel does: with a `trackpad` a plain wheel
|
|
265
|
+
* pans; with a `mouse` a plain wheel zooms. Ctrl/cmd+wheel (how a pinch is
|
|
266
|
+
* delivered) zooms with either device. Shift+wheel pans horizontally;
|
|
267
|
+
* ctrl/cmd+shift+wheel pans vertically. `auto` resolves to `trackpad` until
|
|
268
|
+
* device detection exists — see `resolveInputDevice`
|
|
269
|
+
*/
|
|
270
|
+
inputDevice: InputDevice;
|
|
271
|
+
/**
|
|
272
|
+
* The bindable element the UI highlights for the user when an arrow is
|
|
273
|
+
* dragged or otherwise its endpoint being close to said element.
|
|
274
|
+
*/
|
|
275
|
+
suggestedBinding: {
|
|
276
|
+
element: NonDeleted<ExcalidrawBindableElement>;
|
|
277
|
+
midPoint?: GlobalPoint;
|
|
278
|
+
} | null;
|
|
279
|
+
/**
|
|
280
|
+
* Where on a hovered arrow the text tool would attach text if clicked —
|
|
281
|
+
* a free endpoint (binds the arrow to a new text element positioned against
|
|
282
|
+
* that endpoint) or the arrow's midpoint (adds a label bound to the arrow).
|
|
283
|
+
*/
|
|
284
|
+
hoveredArrowTextAnchor: {
|
|
285
|
+
elementId: ExcalidrawArrowElement["id"];
|
|
286
|
+
anchor: "start" | "end" | "label";
|
|
287
|
+
} | null;
|
|
202
288
|
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
203
289
|
frameRendering: {
|
|
204
290
|
enabled: boolean;
|
|
@@ -206,12 +292,15 @@ export interface AppState {
|
|
|
206
292
|
outline: boolean;
|
|
207
293
|
clip: boolean;
|
|
208
294
|
};
|
|
209
|
-
|
|
210
|
-
|
|
295
|
+
/**
|
|
296
|
+
* frame-like element whose name is currently being edited
|
|
297
|
+
*/
|
|
298
|
+
editingFrame: ExcalidrawFrameLikeElement["id"] | null;
|
|
299
|
+
elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
|
|
211
300
|
/**
|
|
212
301
|
* set when a new text is created or when an existing text is being edited
|
|
213
302
|
*/
|
|
214
|
-
editingTextElement:
|
|
303
|
+
editingTextElement: ExcalidrawTextElement | null;
|
|
215
304
|
activeTool: {
|
|
216
305
|
/**
|
|
217
306
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -221,6 +310,10 @@ export interface AppState {
|
|
|
221
310
|
locked: boolean;
|
|
222
311
|
fromSelection: boolean;
|
|
223
312
|
} & ActiveTool;
|
|
313
|
+
preferredSelectionTool: {
|
|
314
|
+
type: "selection" | "lasso";
|
|
315
|
+
initialized: boolean;
|
|
316
|
+
};
|
|
224
317
|
penMode: boolean;
|
|
225
318
|
penDetected: boolean;
|
|
226
319
|
exportBackground: boolean;
|
|
@@ -228,11 +321,14 @@ export interface AppState {
|
|
|
228
321
|
exportWithDarkMode: boolean;
|
|
229
322
|
exportScale: number;
|
|
230
323
|
currentItemStrokeColor: string;
|
|
324
|
+
currentItemStickynoteStrokeColor: string;
|
|
325
|
+
currentItemStickynoteBackgroundColor: string;
|
|
231
326
|
currentItemBackgroundColor: string;
|
|
232
327
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
233
|
-
|
|
328
|
+
currentItemStrokeWidthKey: StrokeWidthKey;
|
|
234
329
|
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
235
330
|
currentItemRoughness: number;
|
|
331
|
+
currentItemStrokeVariability: StrokeVariability;
|
|
236
332
|
currentItemOpacity: number;
|
|
237
333
|
currentItemFontFamily: FontFamilyValues;
|
|
238
334
|
currentItemFontSize: number;
|
|
@@ -245,14 +341,15 @@ export interface AppState {
|
|
|
245
341
|
viewBackgroundColor: string;
|
|
246
342
|
scrollX: number;
|
|
247
343
|
scrollY: number;
|
|
344
|
+
scrollConstraints: ScrollConstraints | null;
|
|
248
345
|
cursorButton: "up" | "down";
|
|
249
346
|
scrolledOutside: boolean;
|
|
250
347
|
name: string | null;
|
|
251
348
|
isResizing: boolean;
|
|
252
349
|
isRotating: boolean;
|
|
253
350
|
zoom: Zoom;
|
|
254
|
-
openMenu: "canvas" |
|
|
255
|
-
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
|
|
351
|
+
openMenu: "canvas" | null;
|
|
352
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
256
353
|
openSidebar: {
|
|
257
354
|
name: SidebarName;
|
|
258
355
|
tab?: SidebarTabName;
|
|
@@ -264,9 +361,15 @@ export interface AppState {
|
|
|
264
361
|
tab: "text-to-diagram" | "mermaid";
|
|
265
362
|
} | {
|
|
266
363
|
name: "commandPalette";
|
|
364
|
+
} | {
|
|
365
|
+
name: "settings";
|
|
267
366
|
} | {
|
|
268
367
|
name: "elementLinkSelector";
|
|
269
368
|
sourceElementId: ExcalidrawElement["id"];
|
|
369
|
+
} | {
|
|
370
|
+
name: "charts";
|
|
371
|
+
data: Spreadsheet;
|
|
372
|
+
rawText: string;
|
|
270
373
|
};
|
|
271
374
|
/**
|
|
272
375
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
@@ -289,7 +392,7 @@ export interface AppState {
|
|
|
289
392
|
selectedElementsAreBeingDragged: boolean;
|
|
290
393
|
shouldCacheIgnoreZoom: boolean;
|
|
291
394
|
toast: {
|
|
292
|
-
message:
|
|
395
|
+
message: React.ReactNode;
|
|
293
396
|
closable?: boolean;
|
|
294
397
|
duration?: number;
|
|
295
398
|
} | null;
|
|
@@ -311,21 +414,13 @@ export interface AppState {
|
|
|
311
414
|
height: number;
|
|
312
415
|
offsetTop: number;
|
|
313
416
|
offsetLeft: number;
|
|
314
|
-
fileHandle:
|
|
417
|
+
fileHandle: FileSystemFileHandle | null;
|
|
315
418
|
collaborators: Map<SocketId, Collaborator>;
|
|
316
419
|
stats: {
|
|
317
420
|
open: boolean;
|
|
318
421
|
/** bitmap. Use `STATS_PANELS` bit values */
|
|
319
422
|
panels: number;
|
|
320
423
|
};
|
|
321
|
-
currentChartType: ChartType;
|
|
322
|
-
pasteDialog: {
|
|
323
|
-
shown: false;
|
|
324
|
-
data: null;
|
|
325
|
-
} | {
|
|
326
|
-
shown: true;
|
|
327
|
-
data: Spreadsheet;
|
|
328
|
-
};
|
|
329
424
|
showHyperlinkPopup: false | "info" | "editor";
|
|
330
425
|
selectedLinearElement: LinearElementEditor | null;
|
|
331
426
|
snapLines: readonly SnapLine[];
|
|
@@ -334,10 +429,6 @@ export interface AppState {
|
|
|
334
429
|
y: number;
|
|
335
430
|
} | null;
|
|
336
431
|
objectsSnapModeEnabled: boolean;
|
|
337
|
-
/** the user's socket id & username who is being followed on the canvas */
|
|
338
|
-
userToFollow: UserToFollow | null;
|
|
339
|
-
/** the socket ids of the users following the current user */
|
|
340
|
-
followedBy: Set<SocketId>;
|
|
341
432
|
/** image cropping */
|
|
342
433
|
isCropping: boolean;
|
|
343
434
|
croppingElementId: ExcalidrawElement["id"] | null;
|
|
@@ -351,6 +442,24 @@ export interface AppState {
|
|
|
351
442
|
lockedMultiSelections: {
|
|
352
443
|
[groupId: string]: true;
|
|
353
444
|
};
|
|
445
|
+
bindMode: BindMode;
|
|
446
|
+
/** user-customized color-picker top picks (pinned via drag & drop from the
|
|
447
|
+
* color picker popup). `null` means no customization (defaults, or
|
|
448
|
+
* host-supplied `topPicks`, are used). Kept per picker. */
|
|
449
|
+
colorTopPicks: {
|
|
450
|
+
elementStroke: readonly string[] | null;
|
|
451
|
+
elementBackground: readonly string[] | null;
|
|
452
|
+
/** the bucket-fill tool keeps a list separate from `elementBackground`
|
|
453
|
+
* even though both drive `currentItemBackgroundColor` (its defaults and
|
|
454
|
+
* use case differ — no transparent) */
|
|
455
|
+
bucketFill: readonly string[] | null;
|
|
456
|
+
/** sticky notes are their own color domain (own defaults, own picks) */
|
|
457
|
+
stickyNoteStroke: readonly string[] | null;
|
|
458
|
+
stickyNoteBackground: readonly string[] | null;
|
|
459
|
+
};
|
|
460
|
+
/** user-customized font-picker top picks (pinned via drag & drop from the
|
|
461
|
+
* font picker popup). `null` means no customization (defaults are used) */
|
|
462
|
+
fontTopPicks: readonly FontFamilyValues[] | null;
|
|
354
463
|
}
|
|
355
464
|
export type SearchMatch = {
|
|
356
465
|
id: string;
|
|
@@ -363,7 +472,7 @@ export type SearchMatch = {
|
|
|
363
472
|
showOnCanvas: boolean;
|
|
364
473
|
}[];
|
|
365
474
|
};
|
|
366
|
-
export type UIAppState = Omit<AppState, "
|
|
475
|
+
export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom" | "snapLines" | "originSnapOffset" | "suggestedBinding" | "hoveredArrowTextAnchor" | "frameToHighlight" | "elementsToHighlight">;
|
|
367
476
|
export type NormalizedZoomValue = number & {
|
|
368
477
|
_brand: "normalizedZoom";
|
|
369
478
|
};
|
|
@@ -407,15 +516,192 @@ export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePr
|
|
|
407
516
|
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
408
517
|
libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
|
|
409
518
|
}>;
|
|
519
|
+
export type ExcalidrawInitialState = {
|
|
520
|
+
viewport?: Omit<SetViewportOptions, "animation">;
|
|
521
|
+
};
|
|
410
522
|
export type OnUserFollowedPayload = {
|
|
411
523
|
userToFollow: UserToFollow;
|
|
412
524
|
action: "FOLLOW" | "UNFOLLOW";
|
|
413
525
|
};
|
|
526
|
+
export type ViewportStatusFrame = {
|
|
527
|
+
/** the badge (bottom-center pill) */
|
|
528
|
+
label?: {
|
|
529
|
+
label: React.ReactNode;
|
|
530
|
+
icon?: React.ReactNode;
|
|
531
|
+
/** badge background; defaults to var(--color-primary-hover) */
|
|
532
|
+
background?: string;
|
|
533
|
+
/** badge text color; defaults to var(--color-primary-light) */
|
|
534
|
+
color?: string;
|
|
535
|
+
/** makes the badge label interactive */
|
|
536
|
+
onClick?: () => void;
|
|
537
|
+
/** renders a close button when set */
|
|
538
|
+
onClose?: () => void;
|
|
539
|
+
};
|
|
540
|
+
/** viewport-edge border: CSS color, or `false` for none */
|
|
541
|
+
border: false | string;
|
|
542
|
+
};
|
|
543
|
+
export type OnExportProgress = {
|
|
544
|
+
type: "progress";
|
|
545
|
+
message?: React.ReactNode;
|
|
546
|
+
/** 0-1 range */
|
|
547
|
+
progress?: number;
|
|
548
|
+
};
|
|
549
|
+
export type InteractionConfig = {
|
|
550
|
+
/**
|
|
551
|
+
* Interactions that stay enabled while the editor is otherwise
|
|
552
|
+
* non-interactive. Opt-in: anything omitted or `false` is disabled.
|
|
553
|
+
*/
|
|
554
|
+
enabled?: {
|
|
555
|
+
/**
|
|
556
|
+
* Element links render their link icon and stay clickable — clicking
|
|
557
|
+
* anywhere on a linked element opens the link, same as in view mode.
|
|
558
|
+
* When disabled, link icons are not rendered at all.
|
|
559
|
+
*
|
|
560
|
+
* @default false
|
|
561
|
+
*/
|
|
562
|
+
links?: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Embeddable & iframe elements stay interactive — hovering & clicking
|
|
565
|
+
* activates them so their content can be used, same as in view mode.
|
|
566
|
+
*
|
|
567
|
+
* @default false
|
|
568
|
+
*/
|
|
569
|
+
embeds?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Umbrella for all interactive content on canvas — shorthand for
|
|
572
|
+
* enabling `links` & `embeds` (and future interactive content kinds)
|
|
573
|
+
* together. Additive: `interactiveContent: true` enables them
|
|
574
|
+
* regardless of their individual values.
|
|
575
|
+
*
|
|
576
|
+
* @default false
|
|
577
|
+
*/
|
|
578
|
+
interactiveContent?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Canvas navigation — panning (pointer drag, wheel, PageUp/PageDown)
|
|
581
|
+
* and zooming (ctrl/cmd + wheel, pinch, and the canvas zoom &
|
|
582
|
+
* zoom-to-fit shortcuts: ctrl/cmd +/-/0, shift+1/2/3), same as in view
|
|
583
|
+
* mode. Respects `appState.scrollConstraints` if set, so it composes
|
|
584
|
+
* with viewport locking. The rest of the keyboard stays disabled. Note
|
|
585
|
+
* the editor consumes wheel & touch input again when enabled, so the
|
|
586
|
+
* page no longer scrolls over the editor.
|
|
587
|
+
*
|
|
588
|
+
* @default false
|
|
589
|
+
*/
|
|
590
|
+
navigation?: boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Whether the browser's own zoom remains available over the editor —
|
|
593
|
+
* ctrl/cmd + wheel, pinch, and (while the editor has focus)
|
|
594
|
+
* ctrl/cmd +/-/0 shortcuts. Prevented by default, mirroring the
|
|
595
|
+
* interactive editor. Regular page scrolling stays available either way.
|
|
596
|
+
* With `navigation` enabled, the zoom input (wheel, pinch, keyboard
|
|
597
|
+
* shortcuts) zooms the canvas instead either way, making this moot.
|
|
598
|
+
*
|
|
599
|
+
* @default false
|
|
600
|
+
*/
|
|
601
|
+
browserZoom?: boolean;
|
|
602
|
+
/**
|
|
603
|
+
* Tools that stay user-driven while the editor is otherwise
|
|
604
|
+
* non-interactive: pointer input keeps driving the listed tool when it's
|
|
605
|
+
* the active tool. Does not enable user-driven tool *switching* — the
|
|
606
|
+
* keyboard stays disabled and tool selection remains host-driven
|
|
607
|
+
* (`ExcalidrawAPI.setActiveTool`).
|
|
608
|
+
*
|
|
609
|
+
* Composes with `navigation`: the enabled tool wins the primary-pointer
|
|
610
|
+
* drag, while wheel input (and wheel-button drag) still pans/zooms.
|
|
611
|
+
*/
|
|
612
|
+
tools?: {
|
|
613
|
+
/**
|
|
614
|
+
* The laser pointer stays usable — pointer strokes draw laser trails
|
|
615
|
+
* and pointer positions keep broadcasting via `onPointerUpdate`, so
|
|
616
|
+
* e.g. collaborators see a presenter's laser & cursor.
|
|
617
|
+
*
|
|
618
|
+
* @default false
|
|
619
|
+
*/
|
|
620
|
+
laser?: boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Custom tools (`activeTool.type === "custom"`) stay usable — the
|
|
623
|
+
* editor keeps dispatching `onPointerDown` / `onPointerUp` for them.
|
|
624
|
+
* Tool behavior is host-implemented; activate custom tools with
|
|
625
|
+
* `locked: true` or they revert to the selection tool (and go inert)
|
|
626
|
+
* after the first pointer interaction.
|
|
627
|
+
*
|
|
628
|
+
* @default false
|
|
629
|
+
*/
|
|
630
|
+
custom?: boolean;
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
export type UIConfig = {
|
|
635
|
+
/**
|
|
636
|
+
* Default UI controls that stay enabled while the rest of Excalidraw's
|
|
637
|
+
* default UI is hidden. Opt-in: anything omitted or `false` is disabled.
|
|
638
|
+
*/
|
|
639
|
+
enabled: {
|
|
640
|
+
/**
|
|
641
|
+
* The zoom-out, reset-zoom, and zoom-in controls.
|
|
642
|
+
*
|
|
643
|
+
* @default false
|
|
644
|
+
*/
|
|
645
|
+
zoom?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* The button shown when the viewport is scrolled away from all content.
|
|
648
|
+
*
|
|
649
|
+
* @default false
|
|
650
|
+
*/
|
|
651
|
+
scrollBackToContent?: boolean;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
/** Supported visual changes. Geometry, content, bindings and styles are not overridable. */
|
|
655
|
+
export type ElementRenderOverride = Readonly<{
|
|
656
|
+
/** Absolute render opacity (0–100, clamped). Omitted: use element.opacity. */
|
|
657
|
+
opacity?: number;
|
|
658
|
+
/** Translation in scene units. Bound labels inherit their container's offset and ignore this field. */
|
|
659
|
+
offset?: Readonly<{
|
|
660
|
+
x: number;
|
|
661
|
+
y: number;
|
|
662
|
+
}>;
|
|
663
|
+
}>;
|
|
664
|
+
/** see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details */
|
|
665
|
+
export type ElementRenderOverrides = ReadonlyMap<ExcalidrawElement["id"], ElementRenderOverride>;
|
|
666
|
+
/** The translation part of a snapshot: only the entries that carry an offset. */
|
|
667
|
+
export type ElementRenderOffsets = ReadonlyMap<ExcalidrawElement["id"], NonNullable<ElementRenderOverride["offset"]>>;
|
|
414
668
|
export interface ExcalidrawProps {
|
|
669
|
+
className?: string;
|
|
670
|
+
/**
|
|
671
|
+
* Document that owns Excalidraw's mounted DOM.
|
|
672
|
+
*
|
|
673
|
+
* Set only when it differs from the global `document`, such as when code
|
|
674
|
+
* executing in a parent window mounts Excalidraw into an iframe document.
|
|
675
|
+
* The value must remain stable for the editor's lifetime.
|
|
676
|
+
*
|
|
677
|
+
* @default document
|
|
678
|
+
*/
|
|
679
|
+
ownerDocument?: Document;
|
|
415
680
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
681
|
+
onThemeChange?: (theme: Theme | "system") => void;
|
|
682
|
+
/**
|
|
683
|
+
* note: only subscribes if the props.onIncrement is defined on initial render
|
|
684
|
+
*/
|
|
416
685
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
417
686
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
418
|
-
|
|
687
|
+
initialState?: ExcalidrawInitialState;
|
|
688
|
+
/**
|
|
689
|
+
* Invoked as soon as the Excalidraw API is available
|
|
690
|
+
* NOTE editor is not yet mounted, and state is not yet initialized
|
|
691
|
+
*/
|
|
692
|
+
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
|
|
693
|
+
/**
|
|
694
|
+
* Invoked once the editor root is mounted.
|
|
695
|
+
*/
|
|
696
|
+
onMount?: (payload: ExcalidrawMountPayload) => void;
|
|
697
|
+
/**
|
|
698
|
+
* Invoked when the editor root is unmounted.
|
|
699
|
+
*/
|
|
700
|
+
onUnmount?: () => void;
|
|
701
|
+
/**
|
|
702
|
+
* Invoked once the initial scene is loaded.
|
|
703
|
+
*/
|
|
704
|
+
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
|
|
419
705
|
isCollaborating?: boolean;
|
|
420
706
|
onPointerUpdate?: (payload: {
|
|
421
707
|
pointer: {
|
|
@@ -436,14 +722,95 @@ export interface ExcalidrawProps {
|
|
|
436
722
|
*
|
|
437
723
|
* Returned elements will be used in place of the next elements
|
|
438
724
|
* (you should return all elements, including deleted, and not mutate
|
|
439
|
-
* the element if changes are made)
|
|
725
|
+
* the element if changes are made).
|
|
726
|
+
*
|
|
727
|
+
* The duplicates are the elements in `nextElements` which are not in
|
|
728
|
+
* `prevElements` (see also `data.duplicateElements`). When pasting or
|
|
729
|
+
* inserting onto a frame, their `frameId` is already set. To change a
|
|
730
|
+
* duplicate, return a new object with the same `id`. It is shallow-merged
|
|
731
|
+
* into the duplicate (omitted properties are kept), and your changes are
|
|
732
|
+
* part of the duplication itself (same undo entry, same durable increment).
|
|
733
|
+
*
|
|
734
|
+
* To prevent an element from being duplicated, omit its duplicate from the
|
|
735
|
+
* returned array. References to it from the remaining duplicates are
|
|
736
|
+
* cleared, and a bound text isn't duplicated without its container. To
|
|
737
|
+
* prevent the duplication as a whole, return `false`. If no duplicate
|
|
738
|
+
* remains, the duplication is cancelled and the returned elements are
|
|
739
|
+
* ignored (alt-drag then moves the original elements instead).
|
|
440
740
|
*/
|
|
441
741
|
onDuplicate?: (nextElements: readonly ExcalidrawElement[],
|
|
442
742
|
/** excludes the duplicated elements */
|
|
443
|
-
prevElements: readonly ExcalidrawElement[]
|
|
743
|
+
prevElements: readonly ExcalidrawElement[],
|
|
744
|
+
/** lookups covering just the elements taking part in the duplication */
|
|
745
|
+
data: OnDuplicateData) => ExcalidrawElement[] | void | false;
|
|
746
|
+
renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
444
747
|
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
445
748
|
langCode?: Language["code"];
|
|
446
749
|
viewModeEnabled?: boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Whether the editor accepts user input (pointer, keyboard, wheel, touch,
|
|
752
|
+
* clipboard, drag&drop). When `false`, the scene still renders and reacts
|
|
753
|
+
* to programmatic updates (imperative API), but the user cannot affect it
|
|
754
|
+
* in any way. Implies view mode.
|
|
755
|
+
*
|
|
756
|
+
* Pass a config object to keep specific interactions enabled while the
|
|
757
|
+
* editor is otherwise non-interactive (see `InteractionConfig`):
|
|
758
|
+
*
|
|
759
|
+
* ```tsx
|
|
760
|
+
* <Excalidraw interaction={{ enabled: { links: true } }} />
|
|
761
|
+
* ```
|
|
762
|
+
*
|
|
763
|
+
* @default true
|
|
764
|
+
*/
|
|
765
|
+
interaction?: boolean | InteractionConfig;
|
|
766
|
+
/**
|
|
767
|
+
* Whether Excalidraw's default UI is rendered — toolbar, default menus,
|
|
768
|
+
* footer controls, sidebars, and canvas popups. Host UI passed through
|
|
769
|
+
* children (including exported components such as `MainMenu` and `Footer`)
|
|
770
|
+
* or render props continues to render, together with any supporting dialogs
|
|
771
|
+
* it opens.
|
|
772
|
+
*
|
|
773
|
+
* Canvas content (elements, text editing surface, frame names, embeds) still
|
|
774
|
+
* renders, and the editor remains interactive unless `interaction` is set to
|
|
775
|
+
* `false`.
|
|
776
|
+
*
|
|
777
|
+
* Pass a config object to keep specific default controls rendered while the
|
|
778
|
+
* rest of the default UI is hidden (see `UIConfig`):
|
|
779
|
+
*
|
|
780
|
+
* ```tsx
|
|
781
|
+
* <Excalidraw ui={{ enabled: { zoom: true } }} />
|
|
782
|
+
* ```
|
|
783
|
+
*
|
|
784
|
+
* NOTE: this is WIP and what default UI is/is not rendered when ui=false
|
|
785
|
+
* may yet change.
|
|
786
|
+
*
|
|
787
|
+
* @default true
|
|
788
|
+
*/
|
|
789
|
+
ui?: boolean | UIConfig;
|
|
790
|
+
/**
|
|
791
|
+
* Forces the active editor tool (controlled). While set, user- and
|
|
792
|
+
* API-driven tool switching is ignored — `setActiveTool` refuses with a
|
|
793
|
+
* console warning, non-forced toolbar buttons render disabled — and the
|
|
794
|
+
* editor snaps back if internal flows reset the tool. The forced tool
|
|
795
|
+
* behaves as if locked (see the tool lock / padlock): it doesn't revert to
|
|
796
|
+
* the selection tool after use, and elements drawn with it aren't
|
|
797
|
+
* auto-selected — without mutating `appState.activeTool.locked`, so the
|
|
798
|
+
* user's persisted padlock preference stays untouched. Unset to return
|
|
799
|
+
* tool control to the editor (the current tool stays active).
|
|
800
|
+
*
|
|
801
|
+
* The forced tool must be activatable to take effect: not disabled via
|
|
802
|
+
* `UIOptions.tools`, and — while the editor is non-interactive — allowed
|
|
803
|
+
* via `interaction.enabled.tools`. Otherwise the editor stays on (or, when
|
|
804
|
+
* non-interactive, resets to) the `selection` tool, and the forced tool is
|
|
805
|
+
* applied once it becomes activatable. `image` cannot be forced (its
|
|
806
|
+
* activation opens the file picker).
|
|
807
|
+
*/
|
|
808
|
+
activeTool?: {
|
|
809
|
+
type: Exclude<ToolType, "image">;
|
|
810
|
+
} | {
|
|
811
|
+
type: "custom";
|
|
812
|
+
customType: string;
|
|
813
|
+
};
|
|
447
814
|
zenModeEnabled?: boolean;
|
|
448
815
|
gridModeEnabled?: boolean;
|
|
449
816
|
objectsSnapModeEnabled?: boolean;
|
|
@@ -452,6 +819,10 @@ export interface ExcalidrawProps {
|
|
|
452
819
|
name?: string;
|
|
453
820
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
454
821
|
UIOptions?: Partial<UIOptions>;
|
|
822
|
+
/**
|
|
823
|
+
* dimensions and size constraints for inserted images
|
|
824
|
+
*/
|
|
825
|
+
imageOptions?: ImageOptions;
|
|
455
826
|
detectScroll?: boolean;
|
|
456
827
|
handleKeyboardGlobally?: boolean;
|
|
457
828
|
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
@@ -471,9 +842,48 @@ export interface ExcalidrawProps {
|
|
|
471
842
|
aiEnabled?: boolean;
|
|
472
843
|
showDeprecatedFonts?: boolean;
|
|
473
844
|
renderScrollbars?: boolean;
|
|
845
|
+
viewportStatusFrame?: ViewportStatusFrame | null;
|
|
846
|
+
/**
|
|
847
|
+
* Rendered inside the UserList "who's here" dropdown (desktop) and inline
|
|
848
|
+
* in the mobile menu's collaborators section, below a divider. Accepts a
|
|
849
|
+
* render function — called with `isMobile` so hosts can render different
|
|
850
|
+
* UI for each surface — in addition to a plain node.
|
|
851
|
+
*/
|
|
852
|
+
currentUserControls?: React.ReactNode | ((isMobile: boolean) => React.ReactNode);
|
|
853
|
+
/**
|
|
854
|
+
* The user being followed on the canvas, if any. Controlled by the host —
|
|
855
|
+
* the editor never sets it; it emits follow/unfollow intents via
|
|
856
|
+
* `onUserFollow` (prop or imperative API) and renders the followed
|
|
857
|
+
* user's avatar highlight from this value.
|
|
858
|
+
*/
|
|
859
|
+
userToFollow?: UserToFollow | null;
|
|
860
|
+
/**
|
|
861
|
+
* Called before exporting to a file.
|
|
862
|
+
*
|
|
863
|
+
* Allows the host app to intercept and delay saving until async operations
|
|
864
|
+
* (e.g., images are loaded) complete.
|
|
865
|
+
*
|
|
866
|
+
* If Promise/AsyncGenerator is returned, a progress toast will be shown
|
|
867
|
+
* until the operation completes. Generator can yield progress updates.
|
|
868
|
+
*/
|
|
869
|
+
onExport?: (
|
|
870
|
+
/** type of export. Currently we only call for JSON exports or
|
|
871
|
+
* JSON-embedded PNG (which is also identified as `json` type here)*/
|
|
872
|
+
type: "json", data: {
|
|
873
|
+
elements: readonly ExcalidrawElement[];
|
|
874
|
+
appState: AppState;
|
|
875
|
+
files: BinaryFiles;
|
|
876
|
+
}, options: {
|
|
877
|
+
/** signal that gets aborted if user cancels the export (e.g. closes
|
|
878
|
+
* the native file picker dialog). In that case, you can either
|
|
879
|
+
* return immediately, or throw AbortError.
|
|
880
|
+
*/
|
|
881
|
+
signal: AbortSignal;
|
|
882
|
+
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
474
883
|
}
|
|
475
884
|
export type SceneData = {
|
|
476
|
-
|
|
885
|
+
/** Expects normalized elements; restore imported data before updating the scene. */
|
|
886
|
+
elements?: readonly ExcalidrawElement[] | null;
|
|
477
887
|
appState?: ImportedDataState["appState"];
|
|
478
888
|
collaborators?: Map<SocketId, Collaborator>;
|
|
479
889
|
captureUpdate?: CaptureUpdateActionType;
|
|
@@ -483,12 +893,21 @@ export type ExportOpts = {
|
|
|
483
893
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
|
|
484
894
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
485
895
|
};
|
|
896
|
+
export type ImageOptions = Partial<{
|
|
897
|
+
maxWidthOrHeight: number;
|
|
898
|
+
maxFileSizeBytes: number;
|
|
899
|
+
}>;
|
|
486
900
|
export type CanvasActions = Partial<{
|
|
487
901
|
changeViewBackgroundColor: boolean;
|
|
488
902
|
clearCanvas: boolean;
|
|
489
903
|
export: false | ExportOpts;
|
|
490
904
|
loadScene: boolean;
|
|
491
905
|
saveToActiveFile: boolean;
|
|
906
|
+
/**
|
|
907
|
+
* defaults to true if `props.theme` is omitted or `props.onThemeChange`
|
|
908
|
+
* is supplied (at which point the theme is considered as host-app controlled),
|
|
909
|
+
* else default to false
|
|
910
|
+
* */
|
|
492
911
|
toggleTheme: boolean | null;
|
|
493
912
|
saveAsImage: boolean;
|
|
494
913
|
}>;
|
|
@@ -498,6 +917,11 @@ export type UIOptions = Partial<{
|
|
|
498
917
|
tools: {
|
|
499
918
|
image: boolean;
|
|
500
919
|
};
|
|
920
|
+
/**
|
|
921
|
+
* Optionally control the editor form factor and desktop UI mode from the host app.
|
|
922
|
+
* If not provided, we will take care of it internally.
|
|
923
|
+
*/
|
|
924
|
+
getFormFactor?: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
|
|
501
925
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
502
926
|
welcomeScreen?: boolean;
|
|
503
927
|
}>;
|
|
@@ -507,6 +931,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
507
931
|
export: ExportOpts;
|
|
508
932
|
};
|
|
509
933
|
}>;
|
|
934
|
+
imageOptions: Required<ImageOptions>;
|
|
510
935
|
detectScroll: boolean;
|
|
511
936
|
handleKeyboardGlobally: boolean;
|
|
512
937
|
isCollaborating: boolean;
|
|
@@ -518,6 +943,10 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
518
943
|
export type AppClassProperties = {
|
|
519
944
|
props: AppProps;
|
|
520
945
|
state: AppState;
|
|
946
|
+
readonly ownerDocument: Document;
|
|
947
|
+
readonly ownerWindow: Window & typeof globalThis;
|
|
948
|
+
api: App["api"];
|
|
949
|
+
sessionExportThemeOverride: App["sessionExportThemeOverride"];
|
|
521
950
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
522
951
|
/** static canvas */
|
|
523
952
|
canvas: HTMLCanvasElement;
|
|
@@ -528,7 +957,7 @@ export type AppClassProperties = {
|
|
|
528
957
|
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
529
958
|
}>;
|
|
530
959
|
files: BinaryFiles;
|
|
531
|
-
|
|
960
|
+
editorInterface: App["editorInterface"];
|
|
532
961
|
scene: App["scene"];
|
|
533
962
|
syncActionResult: App["syncActionResult"];
|
|
534
963
|
fonts: App["fonts"];
|
|
@@ -536,8 +965,7 @@ export type AppClassProperties = {
|
|
|
536
965
|
id: App["id"];
|
|
537
966
|
onInsertElements: App["onInsertElements"];
|
|
538
967
|
onExportImage: App["onExportImage"];
|
|
539
|
-
|
|
540
|
-
scrollToContent: App["scrollToContent"];
|
|
968
|
+
viewport: App["viewport"];
|
|
541
969
|
addFiles: App["addFiles"];
|
|
542
970
|
addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
|
|
543
971
|
togglePenMode: App["togglePenMode"];
|
|
@@ -548,15 +976,33 @@ export type AppClassProperties = {
|
|
|
548
976
|
onMagicframeToolSelect: App["onMagicframeToolSelect"];
|
|
549
977
|
getName: App["getName"];
|
|
550
978
|
dismissLinearEditor: App["dismissLinearEditor"];
|
|
551
|
-
|
|
979
|
+
flowchart: App["flowchart"];
|
|
980
|
+
drawShape: App["drawShape"];
|
|
981
|
+
arrowText: App["arrowText"];
|
|
982
|
+
cursor: App["cursor"];
|
|
983
|
+
bucketFill: App["bucketFill"];
|
|
984
|
+
duplicate: App["duplicate"];
|
|
985
|
+
toolDrag: App["toolDrag"];
|
|
986
|
+
activeResizeHandle: App["activeResizeHandle"];
|
|
987
|
+
isToolLocked: App["isToolLocked"];
|
|
552
988
|
getEffectiveGridSize: App["getEffectiveGridSize"];
|
|
553
989
|
setPlugins: App["setPlugins"];
|
|
554
990
|
plugins: App["plugins"];
|
|
555
|
-
getEditorUIOffsets: App["getEditorUIOffsets"];
|
|
556
991
|
visibleElements: App["visibleElements"];
|
|
557
992
|
excalidrawContainerValue: App["excalidrawContainerValue"];
|
|
558
993
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
559
994
|
updateEditorAtom: App["updateEditorAtom"];
|
|
995
|
+
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
996
|
+
onEvent: App["onEvent"];
|
|
997
|
+
onStateChange: App["onStateChange"];
|
|
998
|
+
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
999
|
+
lastPointerMoveEvent: App["lastPointerMoveEvent"];
|
|
1000
|
+
bindModeHandler: App["bindModeHandler"];
|
|
1001
|
+
emitUserFollowIntent: App["emitUserFollowIntent"];
|
|
1002
|
+
requestUnfollow: App["requestUnfollow"];
|
|
1003
|
+
setAppState: App["setAppState"];
|
|
1004
|
+
isInteractionEnabled: App["isInteractionEnabled"];
|
|
1005
|
+
isNavigationEnabled: App["isNavigationEnabled"];
|
|
560
1006
|
};
|
|
561
1007
|
export type PointerDownState = Readonly<{
|
|
562
1008
|
origin: Readonly<{
|
|
@@ -592,6 +1038,7 @@ export type PointerDownState = Readonly<{
|
|
|
592
1038
|
wasAddedToSelection: boolean;
|
|
593
1039
|
hasBeenDuplicated: boolean;
|
|
594
1040
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
1041
|
+
arrowLabel: boolean;
|
|
595
1042
|
};
|
|
596
1043
|
withCmdOrCtrl: boolean;
|
|
597
1044
|
drag: {
|
|
@@ -604,6 +1051,7 @@ export type PointerDownState = Readonly<{
|
|
|
604
1051
|
x: number;
|
|
605
1052
|
y: number;
|
|
606
1053
|
};
|
|
1054
|
+
blockDragging: boolean;
|
|
607
1055
|
};
|
|
608
1056
|
eventListeners: {
|
|
609
1057
|
onMove: null | ReturnType<typeof throttleRAF>;
|
|
@@ -616,7 +1064,18 @@ export type PointerDownState = Readonly<{
|
|
|
616
1064
|
};
|
|
617
1065
|
}>;
|
|
618
1066
|
export type UnsubscribeCallback = () => void;
|
|
1067
|
+
export type ExcalidrawMountPayload = {
|
|
1068
|
+
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
1069
|
+
container: HTMLDivElement | null;
|
|
1070
|
+
};
|
|
1071
|
+
export type ExcalidrawImperativeAPIEventMap = {
|
|
1072
|
+
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
1073
|
+
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
1074
|
+
"editor:unmount": [];
|
|
1075
|
+
};
|
|
619
1076
|
export interface ExcalidrawImperativeAPI {
|
|
1077
|
+
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
1078
|
+
isDestroyed: boolean;
|
|
620
1079
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
621
1080
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
622
1081
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
@@ -631,16 +1090,34 @@ export interface ExcalidrawImperativeAPI {
|
|
|
631
1090
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
632
1091
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
633
1092
|
getName: InstanceType<typeof App>["getName"];
|
|
634
|
-
|
|
1093
|
+
setViewport: InstanceType<typeof App>["viewport"]["setViewport"];
|
|
1094
|
+
getViewportOffsets: InstanceType<typeof App>["viewport"]["getOffsets"];
|
|
1095
|
+
/**
|
|
1096
|
+
* Atomically replaces all transient visual overrides. Values are copied;
|
|
1097
|
+
* omitted IDs/fields use document values, except for inherited label offsets.
|
|
1098
|
+
* null clears the snapshot.
|
|
1099
|
+
* Repaints without document changes, history entries or onChange events;
|
|
1100
|
+
* an equivalent snapshot may still repaint (clearing an already clear
|
|
1101
|
+
* snapshot does not), so submit only when something changed.
|
|
1102
|
+
* Finite opacity is clamped to 0–100; non-finite values reject the snapshot.
|
|
1103
|
+
* Unknown/deleted IDs are ignored when rendering. Reset/unmount clears it.
|
|
1104
|
+
* Bound labels inherit their container's offset; offsets targeting them are
|
|
1105
|
+
* ignored. Label opacity remains independent. Target frame children explicitly.
|
|
1106
|
+
* Frame opacity still multiplies child opacity. Decorations follow their owner.
|
|
1107
|
+
* Exports and interactive geometry (hit tests, selection, editing) use document
|
|
1108
|
+
* values, including while authoring an animation preview in edit mode.
|
|
1109
|
+
*/
|
|
1110
|
+
setElementRenderOverrides: InstanceType<typeof App>["setElementRenderOverrides"];
|
|
635
1111
|
registerAction: (action: Action) => void;
|
|
636
1112
|
refresh: InstanceType<typeof App>["refresh"];
|
|
637
1113
|
setToast: InstanceType<typeof App>["setToast"];
|
|
638
1114
|
addFiles: (data: BinaryFileData[]) => void;
|
|
639
1115
|
id: string;
|
|
640
1116
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
641
|
-
setCursor: InstanceType<typeof App>["
|
|
642
|
-
resetCursor: InstanceType<typeof App>["
|
|
1117
|
+
setCursor: InstanceType<typeof App>["cursor"]["set"];
|
|
1118
|
+
resetCursor: InstanceType<typeof App>["cursor"]["reset"];
|
|
643
1119
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
1120
|
+
getEditorInterface: () => EditorInterface;
|
|
644
1121
|
/**
|
|
645
1122
|
* Disables rendering of frames (including element clipping), but currently
|
|
646
1123
|
* the frames are still interactive in edit mode. As such, this API should be
|
|
@@ -653,24 +1130,14 @@ export interface ExcalidrawImperativeAPI {
|
|
|
653
1130
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
654
1131
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
655
1132
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
1133
|
+
onStateChange: InstanceType<typeof App>["onStateChange"];
|
|
1134
|
+
onEvent: InstanceType<typeof App>["onEvent"];
|
|
656
1135
|
}
|
|
657
|
-
export type Device = Readonly<{
|
|
658
|
-
viewport: {
|
|
659
|
-
isMobile: boolean;
|
|
660
|
-
isLandscape: boolean;
|
|
661
|
-
};
|
|
662
|
-
editor: {
|
|
663
|
-
isMobile: boolean;
|
|
664
|
-
canFitSidebar: boolean;
|
|
665
|
-
};
|
|
666
|
-
isTouchScreen: boolean;
|
|
667
|
-
}>;
|
|
668
1136
|
export type FrameNameBounds = {
|
|
669
1137
|
x: number;
|
|
670
1138
|
y: number;
|
|
671
1139
|
width: number;
|
|
672
1140
|
height: number;
|
|
673
|
-
angle: number;
|
|
674
1141
|
};
|
|
675
1142
|
export type FrameNameBoundsCache = {
|
|
676
1143
|
get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
|
|
@@ -689,12 +1156,18 @@ export type Primitive = number | string | boolean | bigint | symbol | null | und
|
|
|
689
1156
|
export type JSONValue = string | number | boolean | null | object;
|
|
690
1157
|
export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
|
|
691
1158
|
export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
|
|
692
|
-
export type PendingExcalidrawElements =
|
|
1159
|
+
export type PendingExcalidrawElements = NonDeletedExcalidrawElement[];
|
|
693
1160
|
/** Runtime gridSize value. Null indicates disabled grid. */
|
|
694
1161
|
export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
|
|
695
1162
|
export type GenerateDiagramToCode = (props: {
|
|
696
|
-
frame: ExcalidrawMagicFrameElement
|
|
697
|
-
children: readonly
|
|
1163
|
+
frame: NonDeleted<ExcalidrawMagicFrameElement>;
|
|
1164
|
+
children: readonly NonDeletedExcalidrawElement[];
|
|
1165
|
+
/**
|
|
1166
|
+
* Optional streaming hook. Call with the accumulated response text as it
|
|
1167
|
+
* streams in so the editor can progressively render the partial HTML
|
|
1168
|
+
* inside the generated frame.
|
|
1169
|
+
*/
|
|
1170
|
+
onPartial?: (html: string) => void;
|
|
698
1171
|
}) => MaybePromise<{
|
|
699
1172
|
html: string;
|
|
700
1173
|
}>;
|
|
@@ -704,4 +1177,102 @@ export type Offsets = Partial<{
|
|
|
704
1177
|
bottom: number;
|
|
705
1178
|
left: number;
|
|
706
1179
|
}>;
|
|
707
|
-
|
|
1180
|
+
/**
|
|
1181
|
+
* Value of the `data-viewport-ui` attribute, marking a DOM node as a UI
|
|
1182
|
+
* surface that occludes the canvas. Such nodes are measured by
|
|
1183
|
+
* `getViewportOffsets` to compute the default per-side viewport offsets:
|
|
1184
|
+
*
|
|
1185
|
+
* - `top` / `bottom` — offsets that side by the node's bottom/top edge
|
|
1186
|
+
* - `side` — a panel hugging the left or right edge. Which side is not
|
|
1187
|
+
* declared but resolved geometrically: if the node's horizontal center
|
|
1188
|
+
* lies in the left half of the viewport it counts against the left
|
|
1189
|
+
* offset (by its right edge), otherwise against the right offset (by
|
|
1190
|
+
* `viewportWidth - left edge`). Measuring the rendered position instead
|
|
1191
|
+
* of declaring a side means RTL layouts and host-configurable docking
|
|
1192
|
+
* (e.g. sidebar side) are handled for free — but it assumes the surface
|
|
1193
|
+
* actually hugs one edge; don't mark a centered/near-full-width node as
|
|
1194
|
+
* `side` (its midpoint would classify it to one side and the offset
|
|
1195
|
+
* would swallow most of the viewport).
|
|
1196
|
+
*
|
|
1197
|
+
* The attribute should only be present while the surface is actually
|
|
1198
|
+
* rendered — omit it (don't just hide the node) when the surface shouldn't
|
|
1199
|
+
* push the viewport around.
|
|
1200
|
+
*/
|
|
1201
|
+
export type ViewportUIDock = "top" | "bottom" | "side";
|
|
1202
|
+
/**
|
|
1203
|
+
* Options for `getViewportOffsets` (and the `ui` key of
|
|
1204
|
+
* {@link ViewportOffsets}), controlling how offsets are derived from the
|
|
1205
|
+
* currently rendered editor UI.
|
|
1206
|
+
*
|
|
1207
|
+
* NOTE unlike the physical sides of {@link Offsets}, the horizontal values
|
|
1208
|
+
* here are logical, i.e. flipped in RTL layouts (`left` refers to the
|
|
1209
|
+
* reading-direction start side).
|
|
1210
|
+
*/
|
|
1211
|
+
export type ViewportOffsetsOptions = {
|
|
1212
|
+
/** padding added to each measured side (default 24) */
|
|
1213
|
+
padding?: number;
|
|
1214
|
+
paddingTop?: number;
|
|
1215
|
+
paddingRight?: number;
|
|
1216
|
+
paddingBottom?: number;
|
|
1217
|
+
paddingLeft?: number;
|
|
1218
|
+
/** final value for the given side, replacing the measured UI size
|
|
1219
|
+
* (padding is not added on top) */
|
|
1220
|
+
top?: number;
|
|
1221
|
+
bottom?: number;
|
|
1222
|
+
left?: number;
|
|
1223
|
+
right?: number;
|
|
1224
|
+
/**
|
|
1225
|
+
* Reserve space for the given conditionally-rendered surfaces even while
|
|
1226
|
+
* they're hidden, so the resulting offsets don't shift when they
|
|
1227
|
+
* (dis)appear. Uses the surface's last-measured footprint, falling back
|
|
1228
|
+
* to an approximate default if it hasn't been rendered yet. Ignored on
|
|
1229
|
+
* phones (where these surfaces never occlude the canvas).
|
|
1230
|
+
*/
|
|
1231
|
+
reserve?: {
|
|
1232
|
+
/** styles panel (rendered when a tool or selection is active) */
|
|
1233
|
+
stylesPanel?: boolean;
|
|
1234
|
+
/** sidebar (e.g. library) */
|
|
1235
|
+
sidebar?: boolean;
|
|
1236
|
+
};
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Viewport offsets accepted by the `setViewport`-family APIs (`setViewport`,
|
|
1240
|
+
* `props.initialState.viewport`), insetting the usable viewport area per
|
|
1241
|
+
* side so the target isn't fitted/centered underneath overlaid UI.
|
|
1242
|
+
*
|
|
1243
|
+
* Two (combinable) ways to specify:
|
|
1244
|
+
*
|
|
1245
|
+
* - **Static sides** (`top`/`right`/`bottom`/`left`) — absolute pixel
|
|
1246
|
+
* values, used as-is: physical (not flipped in RTL), zoom-independent,
|
|
1247
|
+
* no padding added. Sides not specified default to `0` (unless `ui` is
|
|
1248
|
+
* set, see below).
|
|
1249
|
+
*
|
|
1250
|
+
* - **`ui`** — derive the offsets from the editor UI (toolbar, styles
|
|
1251
|
+
* panel, sidebar...) as rendered at the time the viewport is set,
|
|
1252
|
+
* equivalent to calling `getViewportOffsets()`. Pass `true` for the
|
|
1253
|
+
* defaults, or options ({@link ViewportOffsetsOptions}) to customize
|
|
1254
|
+
* padding or reserve space for currently-hidden surfaces.
|
|
1255
|
+
*
|
|
1256
|
+
* When both are given, a static side always wins for that side — it
|
|
1257
|
+
* replaces whatever `ui` would yield (including `ui`'s own side overrides,
|
|
1258
|
+
* which — unlike the physical static sides — are RTL-relative). The
|
|
1259
|
+
* remaining sides fall back to the `ui`-derived values.
|
|
1260
|
+
*
|
|
1261
|
+
* @example
|
|
1262
|
+
* { top: 40 } // top 40px, other sides 0
|
|
1263
|
+
* { ui: true } // measured UI + default padding
|
|
1264
|
+
* { ui: { reserve: { stylesPanel: true } } } // + keep space for hidden panel
|
|
1265
|
+
* { top: 40, ui: true } // top exactly 40px, rest from UI
|
|
1266
|
+
*/
|
|
1267
|
+
export type ViewportOffsets = Offsets & {
|
|
1268
|
+
ui?: true | ViewportOffsetsOptions;
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Value of the `data-viewport-ui-name` attribute, identifying a
|
|
1272
|
+
* conditionally-rendered surface (marked with `data-viewport-ui`) so that
|
|
1273
|
+
* `getViewportOffsets` can reserve space for it while it's hidden (see the
|
|
1274
|
+
* `reserve` option). Whenever a named surface is rendered, its measured
|
|
1275
|
+
* footprint is remembered; reserving uses that remembered footprint, or an
|
|
1276
|
+
* approximate default if the surface hasn't been rendered yet.
|
|
1277
|
+
*/
|
|
1278
|
+
export type ViewportUIName = "sidebar" | "stylesPanel";
|