@excalidraw/common 0.18.0-dda3affcb-8fc71066d → 0.18.0-e9c856d
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 +1698 -328
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +3 -3
- 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 +59 -39
- package/dist/types/common/src/constants.d.ts +47 -34
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +1 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +48 -78
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +12 -8
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +27 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +72 -51
- package/dist/types/element/src/bounds.d.ts +26 -19
- package/dist/types/element/src/collision.d.ts +7 -2
- package/dist/types/element/src/comparisons.d.ts +8 -7
- package/dist/types/element/src/delta.d.ts +4 -5
- package/dist/types/element/src/distribute.d.ts +3 -2
- package/dist/types/element/src/dragElements.d.ts +3 -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 +7 -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 +6 -4
- package/dist/types/element/src/linearElementEditor.d.ts +31 -30
- package/dist/types/element/src/mutateElement.d.ts +5 -1
- package/dist/types/element/src/newElement.d.ts +7 -6
- 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 +9 -8
- package/dist/types/element/src/store.d.ts +5 -0
- package/dist/types/element/src/textElement.d.ts +9 -9
- 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 +3 -3
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +29 -31
- package/dist/types/element/src/types.d.ts +20 -14
- package/dist/types/element/src/utils.d.ts +9 -4
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +176 -210
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +102 -125
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +406 -1576
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +129 -893
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +49 -61
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +164 -202
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -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 +56 -74
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +101 -124
- package/dist/types/excalidraw/actions/actionExport.d.ts +180 -1408
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +277 -534
- package/dist/types/excalidraw/actions/actionGroup.d.ts +112 -143
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +187 -236
- package/dist/types/excalidraw/actions/actionLink.d.ts +62 -74
- package/dist/types/excalidraw/actions/actionMenu.d.ts +51 -435
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +181 -2525
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +56 -72
- package/dist/types/excalidraw/actions/actionStyles.d.ts +49 -60
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +64 -77
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +63 -75
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +52 -71
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +62 -74
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +63 -75
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +63 -75
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/index.d.ts +5 -3
- 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 +7 -7
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +45 -36
- 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 +59 -21
- 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.d.ts +200 -109
- package/dist/types/excalidraw/components/App.flowchart.d.ts +19 -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 +2 -3
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- 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 +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/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- 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 +2 -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 +2 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -6
- 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 -1
- 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 +128 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +8 -4
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -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/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/dist/types/excalidraw/components/icons.d.ts +51 -21
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +24 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +36 -0
- package/dist/types/excalidraw/data/blob.d.ts +331 -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 +171 -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/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/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/renderer/animation.d.ts +16 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
- package/dist/types/excalidraw/scene/Renderer.d.ts +428 -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 +23 -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 +297 -46
- package/dist/types/excalidraw/viewport.d.ts +316 -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 +35 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- package/dist/types/math/src/point.d.ts +8 -2
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +4 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +8 -8
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/package.json +7 -1
- 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/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/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/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/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor,
|
|
4
|
-
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered,
|
|
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 { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
5
5
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
6
|
import { ActionManager } from "../actions/manager";
|
|
7
|
-
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
8
7
|
import { History } from "../history";
|
|
9
8
|
import { Fonts } from "../fonts";
|
|
10
9
|
import { type WritableAtom } from "../editor-jotai";
|
|
11
10
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
-
import {
|
|
11
|
+
import { type SetViewportOptions } from "../viewport";
|
|
12
|
+
import { LaserTrails } from "../laserTrails";
|
|
13
|
+
import { isOverScrollBars } from "../scene/scrollbars";
|
|
13
14
|
import { LassoTrail } from "../lasso";
|
|
14
15
|
import { EraserTrail } from "../eraser";
|
|
16
|
+
import { AppFlowchart } from "./App.flowchart";
|
|
17
|
+
import { CursorHints } from "./CursorHint";
|
|
18
|
+
import { type OnStateChange } from "./AppStateObserver";
|
|
15
19
|
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, ApplyDeltasOptions } from "../types";
|
|
20
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, Offsets, ViewportOffsetsOptions } from "../types";
|
|
18
21
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
19
22
|
import type { ActionResult } from "../actions/types";
|
|
23
|
+
declare const editorLifecycleEventBehavior: {
|
|
24
|
+
readonly "editor:mount": {
|
|
25
|
+
readonly cardinality: "once";
|
|
26
|
+
readonly replay: "last";
|
|
27
|
+
};
|
|
28
|
+
readonly "editor:initialize": {
|
|
29
|
+
readonly cardinality: "once";
|
|
30
|
+
readonly replay: "last";
|
|
31
|
+
};
|
|
32
|
+
readonly "editor:unmount": {
|
|
33
|
+
readonly cardinality: "once";
|
|
34
|
+
readonly replay: "last";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
20
37
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
21
38
|
container: HTMLDivElement | null;
|
|
22
39
|
id: string | null;
|
|
23
40
|
}>;
|
|
41
|
+
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
|
|
42
|
+
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
|
|
24
43
|
export declare const useApp: () => AppClassProperties;
|
|
25
44
|
export declare const useAppProps: () => AppProps;
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
canFitSidebar: boolean;
|
|
34
|
-
};
|
|
45
|
+
export declare const useEditorInterface: () => Readonly<{
|
|
46
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
47
|
+
desktopUIMode: "compact" | "full";
|
|
48
|
+
userAgent: Readonly<{
|
|
49
|
+
isMobileDevice: boolean;
|
|
50
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
51
|
+
}>;
|
|
35
52
|
isTouchScreen: boolean;
|
|
53
|
+
canFitSidebar: boolean;
|
|
54
|
+
isLandscape: boolean;
|
|
36
55
|
}>;
|
|
56
|
+
export declare const useStylesPanelMode: () => StylesPanelMode;
|
|
37
57
|
export declare const useExcalidrawContainer: () => {
|
|
38
58
|
container: HTMLDivElement | null;
|
|
39
59
|
id: string | null;
|
|
@@ -42,20 +62,34 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
42
62
|
export declare const useExcalidrawAppState: () => AppState;
|
|
43
63
|
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
64
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
65
|
+
/**
|
|
66
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
67
|
+
*/
|
|
68
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
45
69
|
declare class App extends React.Component<AppProps, AppState> {
|
|
46
70
|
canvas: AppClassProperties["canvas"];
|
|
47
71
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
72
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
48
73
|
rc: RoughCanvas;
|
|
49
74
|
unmounted: boolean;
|
|
50
75
|
actionManager: ActionManager;
|
|
51
|
-
|
|
76
|
+
editorInterface: EditorInterface;
|
|
77
|
+
private stylesPanelMode;
|
|
78
|
+
/**
|
|
79
|
+
* Last-measured footprints of named viewport UI surfaces
|
|
80
|
+
* (`data-viewport-ui-name`), so `getViewportOffsets` can reserve space
|
|
81
|
+
* for them while they're hidden.
|
|
82
|
+
*/
|
|
83
|
+
private viewportUILastMeasured;
|
|
52
84
|
private excalidrawContainerRef;
|
|
53
85
|
scene: Scene;
|
|
54
86
|
fonts: Fonts;
|
|
55
87
|
renderer: Renderer;
|
|
56
88
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
89
|
+
/** whether the last render had any renderable elements (excludes e.g. the
|
|
90
|
+
* in-progress `newElement` and the edited text element) */
|
|
91
|
+
private hasRenderableElements;
|
|
57
92
|
private resizeObserver;
|
|
58
|
-
private nearestScrollableContainer;
|
|
59
93
|
library: AppClassProperties["library"];
|
|
60
94
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
61
95
|
id: string;
|
|
@@ -78,26 +112,41 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
112
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
79
113
|
* insert to DOM before user initially scrolls to them) */
|
|
80
114
|
private initializedEmbeds;
|
|
81
|
-
private handleToastClose;
|
|
82
115
|
private elementsPendingErasure;
|
|
83
|
-
|
|
84
|
-
private
|
|
116
|
+
private _initialized;
|
|
117
|
+
private readonly editorLifecycleEvents;
|
|
118
|
+
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
119
|
+
private appStateObserver;
|
|
120
|
+
onStateChange: OnStateChange;
|
|
121
|
+
flowchart: AppFlowchart;
|
|
122
|
+
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
85
123
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
86
124
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
87
125
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
126
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
88
127
|
lastPointerMoveEvent: PointerEvent | null;
|
|
128
|
+
/** current frame pointer cords */
|
|
89
129
|
lastPointerMoveCoords: {
|
|
90
130
|
x: number;
|
|
91
131
|
y: number;
|
|
92
132
|
} | null;
|
|
133
|
+
private lastCompletedCanvasClicks;
|
|
134
|
+
/** arrowheads removed via endpoint double-click toggle, so a subsequent
|
|
135
|
+
* toggle can restore the original arrowhead (keyed by `elementId:side`) */
|
|
136
|
+
private removedArrowheads;
|
|
137
|
+
/** previous frame pointer coords */
|
|
138
|
+
previousPointerMoveCoords: {
|
|
139
|
+
x: number;
|
|
140
|
+
y: number;
|
|
141
|
+
} | null;
|
|
93
142
|
lastViewportPosition: {
|
|
94
143
|
x: number;
|
|
95
144
|
y: number;
|
|
96
145
|
};
|
|
97
|
-
animationFrameHandler: AnimationFrameHandler;
|
|
98
146
|
laserTrails: LaserTrails;
|
|
99
147
|
eraserTrail: EraserTrail;
|
|
100
148
|
lassoTrail: LassoTrail;
|
|
149
|
+
cursorHints: CursorHints;
|
|
101
150
|
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
|
|
102
151
|
onPointerDownEmitter: Emitter<[activeTool: {
|
|
103
152
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -112,11 +161,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
112
161
|
x: number;
|
|
113
162
|
y: number;
|
|
114
163
|
}>;
|
|
115
|
-
scrollbars:
|
|
116
|
-
isOverEither: boolean;
|
|
117
|
-
isOverHorizontal: boolean;
|
|
118
|
-
isOverVertical: boolean;
|
|
119
|
-
};
|
|
164
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
120
165
|
lastCoords: {
|
|
121
166
|
x: number;
|
|
122
167
|
y: number;
|
|
@@ -129,7 +174,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
129
174
|
x: number;
|
|
130
175
|
y: number;
|
|
131
176
|
};
|
|
132
|
-
arrowDirection: "
|
|
177
|
+
arrowDirection: "origin" | "end";
|
|
133
178
|
center: {
|
|
134
179
|
x: number;
|
|
135
180
|
y: number;
|
|
@@ -153,16 +198,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
153
198
|
x: number;
|
|
154
199
|
y: number;
|
|
155
200
|
};
|
|
201
|
+
blockDragging: boolean;
|
|
156
202
|
};
|
|
157
203
|
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;
|
|
204
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
205
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
206
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
207
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
166
208
|
};
|
|
167
209
|
boxSelection: {
|
|
168
210
|
hasOccurred: boolean;
|
|
@@ -181,11 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
181
223
|
x: number;
|
|
182
224
|
y: number;
|
|
183
225
|
}>;
|
|
184
|
-
scrollbars:
|
|
185
|
-
isOverEither: boolean;
|
|
186
|
-
isOverHorizontal: boolean;
|
|
187
|
-
isOverVertical: boolean;
|
|
188
|
-
};
|
|
226
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
189
227
|
lastCoords: {
|
|
190
228
|
x: number;
|
|
191
229
|
y: number;
|
|
@@ -198,7 +236,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
198
236
|
x: number;
|
|
199
237
|
y: number;
|
|
200
238
|
};
|
|
201
|
-
arrowDirection: "
|
|
239
|
+
arrowDirection: "origin" | "end";
|
|
202
240
|
center: {
|
|
203
241
|
x: number;
|
|
204
242
|
y: number;
|
|
@@ -222,16 +260,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
222
260
|
x: number;
|
|
223
261
|
y: number;
|
|
224
262
|
};
|
|
263
|
+
blockDragging: boolean;
|
|
225
264
|
};
|
|
226
265
|
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;
|
|
266
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
267
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
268
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
269
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
235
270
|
};
|
|
236
271
|
boxSelection: {
|
|
237
272
|
hasOccurred: boolean;
|
|
@@ -243,17 +278,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
243
278
|
}>]>;
|
|
244
279
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
245
280
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
281
|
+
api: ExcalidrawImperativeAPI;
|
|
282
|
+
private createExcalidrawAPI;
|
|
246
283
|
constructor(props: AppProps);
|
|
247
284
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
248
285
|
private onWindowMessage;
|
|
286
|
+
private handleSkipBindMode;
|
|
287
|
+
private resetDelayedBindMode;
|
|
288
|
+
private previousHoveredBindableElement;
|
|
289
|
+
private handleDelayedBindModeChange;
|
|
249
290
|
private cacheEmbeddableRef;
|
|
250
291
|
/**
|
|
251
292
|
* Returns gridSize taking into account `gridModeEnabled`.
|
|
252
293
|
* If disabled, returns null.
|
|
253
294
|
*/
|
|
254
295
|
getEffectiveGridSize: () => NullableGridSize;
|
|
296
|
+
private getTextCreationGridPoint;
|
|
255
297
|
private getHTMLIFrameElement;
|
|
256
|
-
private
|
|
298
|
+
private handleIframeLikeElementHover;
|
|
299
|
+
/** @returns true if iframe-like element click handled */
|
|
300
|
+
private handleIframeLikeCenterClick;
|
|
301
|
+
private isDoubleClick;
|
|
257
302
|
private isIframeLikeElementCenter;
|
|
258
303
|
private updateEmbedValidationStatus;
|
|
259
304
|
private updateEmbeddables;
|
|
@@ -265,12 +310,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
265
310
|
private toggleOverscrollBehavior;
|
|
266
311
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
267
312
|
focusContainer: AppClassProperties["focusContainer"];
|
|
268
|
-
getSceneElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[];
|
|
269
|
-
getSceneElementsMapIncludingDeleted: () =>
|
|
313
|
+
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
314
|
+
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
|
|
270
315
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
271
316
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
272
317
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
273
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
318
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
274
319
|
}) => Promise<void>;
|
|
275
320
|
private magicGenerations;
|
|
276
321
|
private updateMagicGeneration;
|
|
@@ -297,9 +342,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
297
342
|
*/
|
|
298
343
|
private resetScene;
|
|
299
344
|
private initializeScene;
|
|
300
|
-
private
|
|
301
|
-
|
|
302
|
-
private
|
|
345
|
+
private getFormFactor;
|
|
346
|
+
refreshEditorInterface: () => void;
|
|
347
|
+
private reconcileStylesPanelMode;
|
|
348
|
+
/** TO BE USED LATER */
|
|
349
|
+
private setDesktopUIMode;
|
|
303
350
|
private clearImageShapeCache;
|
|
304
351
|
componentDidMount(): Promise<void>;
|
|
305
352
|
componentWillUnmount(): void;
|
|
@@ -316,6 +363,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
316
363
|
private static resetTapTwice;
|
|
317
364
|
private onTouchStart;
|
|
318
365
|
private onTouchEnd;
|
|
366
|
+
private insertClipboardContent;
|
|
319
367
|
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
320
368
|
addElementsFromPasteOrLibrary: (opts: {
|
|
321
369
|
elements: readonly ExcalidrawElement[];
|
|
@@ -325,54 +373,57 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
325
373
|
clientY: number;
|
|
326
374
|
} | "cursor" | "center";
|
|
327
375
|
retainSeed?: boolean;
|
|
328
|
-
|
|
376
|
+
fit?: SetViewportOptions["fit"];
|
|
377
|
+
preserveFrameChildrenOrder?: boolean;
|
|
329
378
|
}) => void;
|
|
330
379
|
private addElementsFromMixedContentPaste;
|
|
331
380
|
private addTextFromPaste;
|
|
332
381
|
setAppState: React.Component<any, AppState>["setState"];
|
|
333
382
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
334
383
|
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;
|
|
384
|
+
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
341
385
|
togglePenMode: (force: boolean | null) => void;
|
|
342
|
-
onHandToolToggle: () => void;
|
|
343
386
|
/**
|
|
344
387
|
* Zooms on canvas viewport center
|
|
345
388
|
*/
|
|
346
|
-
zoomCanvas: (
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
389
|
+
zoomCanvas: (
|
|
390
|
+
/**
|
|
391
|
+
* Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
|
|
392
|
+
* 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
|
|
393
|
+
*/
|
|
394
|
+
value: number) => void;
|
|
395
|
+
/**
|
|
396
|
+
* Navigates the viewport to a target and, optionally, locks pan/zoom to it.
|
|
397
|
+
* The resolved target box drives both the navigation (pan + zoom per
|
|
398
|
+
* `fit`) and the lock: the operations chain — the viewport animates onto
|
|
399
|
+
* the target, then the lock is installed against the settled viewport.
|
|
400
|
+
*
|
|
401
|
+
* Passing `null` clears any active lock without navigating.
|
|
402
|
+
*/
|
|
403
|
+
/**
|
|
404
|
+
* Resolves user-supplied viewport offsets ({@link ViewportOffsets}) into
|
|
405
|
+
* concrete per-side pixel values: static sides are used as-is, and when
|
|
406
|
+
* `ui` is set, the remaining sides are derived from the currently
|
|
407
|
+
* rendered editor UI (via `getViewportOffsets`).
|
|
408
|
+
*
|
|
409
|
+
* Must be called at the time the offsets are applied (not e.g. cached at
|
|
410
|
+
* props-definition time), so the UI-derived values reflect the actual
|
|
411
|
+
* rendered UI.
|
|
412
|
+
*/
|
|
413
|
+
private resolveViewportOffsets;
|
|
414
|
+
setViewport: (opts: SetViewportOptions | null) => void;
|
|
415
|
+
revealIfHidden: (elements: NonDeletedExcalidrawElement[]) => void;
|
|
368
416
|
private maybeUnfollowRemoteUser;
|
|
369
417
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
370
418
|
private translateCanvas;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
419
|
+
/** clamps scroll/zoom back into `appState.scrollConstraints` (no-op when
|
|
420
|
+
* unconstrained). Runs as a queued update, so it sees the preceding change.
|
|
421
|
+
* `overscroll` (screen px) relaxes the bounds for rubberbanding. */
|
|
422
|
+
private constrainViewportToScrollConstraints;
|
|
423
|
+
/** animates an overscrolled viewport back inside the constraint box */
|
|
424
|
+
private snapBackToScrollConstraints;
|
|
425
|
+
private snapBackToScrollConstraintsDebounced;
|
|
426
|
+
setToast: (toast: AppState["toast"]) => void;
|
|
376
427
|
restoreFileFromShare: () => Promise<void>;
|
|
377
428
|
/**
|
|
378
429
|
* adds supplied files to existing files in the appState.
|
|
@@ -382,7 +433,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
382
433
|
private addMissingFiles;
|
|
383
434
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
384
435
|
elements?: SceneData["elements"];
|
|
385
|
-
appState?: Pick<AppState, K> | null
|
|
436
|
+
appState?: Pick<AppState, K> | null;
|
|
386
437
|
collaborators?: SceneData["collaborators"];
|
|
387
438
|
/**
|
|
388
439
|
* 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,19 +448,31 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
397
448
|
*/
|
|
398
449
|
captureUpdate?: SceneData["captureUpdate"];
|
|
399
450
|
}) => void;
|
|
400
|
-
applyDeltas: (deltas: StoreDelta[], options?:
|
|
451
|
+
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
401
452
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
402
|
-
|
|
453
|
+
triggerRender: (
|
|
454
|
+
/** force always re-renders canvas even if no change */
|
|
455
|
+
force?: boolean) => void;
|
|
403
456
|
/**
|
|
404
457
|
* @returns whether the menu was toggled on or off
|
|
405
458
|
*/
|
|
406
459
|
toggleSidebar: ({ name, tab, force, }: {
|
|
407
460
|
name: SidebarName | null;
|
|
408
|
-
tab?:
|
|
409
|
-
force?: boolean
|
|
461
|
+
tab?: SidebarTabName;
|
|
462
|
+
force?: boolean;
|
|
410
463
|
}) => boolean;
|
|
411
464
|
private updateCurrentCursorPosition;
|
|
412
|
-
|
|
465
|
+
/**
|
|
466
|
+
* top/right/bottom/left override the final offsets for those sides.
|
|
467
|
+
*
|
|
468
|
+
* Default side offsets are measured from the currently rendered UI
|
|
469
|
+
* surfaces marked with the `data-viewport-ui` attribute (see
|
|
470
|
+
* {@link ViewportUIDock}), plus padding.
|
|
471
|
+
*
|
|
472
|
+
* See {@link ViewportOffsetsOptions} for the individual options
|
|
473
|
+
* (padding, per-side overrides, reserving space for hidden surfaces).
|
|
474
|
+
*/
|
|
475
|
+
getViewportOffsets: (opts?: ViewportOffsetsOptions) => Offsets;
|
|
413
476
|
private onKeyDown;
|
|
414
477
|
private onKeyUp;
|
|
415
478
|
private isToolSupported;
|
|
@@ -421,7 +484,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
421
484
|
}) & {
|
|
422
485
|
locked?: boolean;
|
|
423
486
|
fromSelection?: boolean;
|
|
424
|
-
},
|
|
487
|
+
}, opts?: {
|
|
488
|
+
keepSelection?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* When `true`, re-activating an already-active toggle tool (see
|
|
491
|
+
* `TOGGLE_TOOLS`) switches back to the previously active tool.
|
|
492
|
+
* Activation is idempotent by default; toggle tools always record the
|
|
493
|
+
* previously active tool regardless (so ESC and the next `toggle`
|
|
494
|
+
* activation can switch back to it).
|
|
495
|
+
*/
|
|
496
|
+
toggle?: boolean;
|
|
497
|
+
}) => void;
|
|
425
498
|
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
|
|
426
499
|
private setCursor;
|
|
427
500
|
private resetCursor;
|
|
@@ -438,7 +511,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
438
511
|
private onGestureEnd;
|
|
439
512
|
private handleTextWysiwyg;
|
|
440
513
|
private deselectElements;
|
|
514
|
+
private getSelectedTextElement;
|
|
515
|
+
private getSelectedTextEditingContainerAtPosition;
|
|
441
516
|
private getTextElementAtPosition;
|
|
517
|
+
private isHittingTextAutoResizeHandle;
|
|
518
|
+
private handleTextAutoResizeHandlePointerDown;
|
|
442
519
|
private getElementAtPosition;
|
|
443
520
|
private getElementsAtPosition;
|
|
444
521
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
@@ -447,10 +524,26 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
447
524
|
private startTextEditing;
|
|
448
525
|
private startImageCropping;
|
|
449
526
|
private finishImageCropping;
|
|
527
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
528
|
+
/**
|
|
529
|
+
* Toggles the arrowhead at the given endpoint between no arrowhead and the
|
|
530
|
+
* arrowhead it had before the last toggle (falling back to the current
|
|
531
|
+
* default arrowhead).
|
|
532
|
+
*/
|
|
533
|
+
private toggleArrowheadAtEndpoint;
|
|
450
534
|
private handleCanvasDoubleClick;
|
|
535
|
+
private handleCanvasClick;
|
|
451
536
|
private getElementLinkAtPosition;
|
|
452
|
-
private
|
|
537
|
+
private handleElementLinkClick;
|
|
538
|
+
/**
|
|
539
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
540
|
+
* inside frames)
|
|
541
|
+
*/
|
|
453
542
|
private getTopLayerFrameAtSceneCoords;
|
|
543
|
+
private updateFrameToHighlight;
|
|
544
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
545
|
+
insertNewElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
546
|
+
private insertNewElement;
|
|
454
547
|
private handleCanvasPointerMove;
|
|
455
548
|
private handleEraser;
|
|
456
549
|
private handleTouchMove;
|
|
@@ -489,9 +582,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
489
582
|
sceneY: number;
|
|
490
583
|
link: string;
|
|
491
584
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
492
|
-
private
|
|
585
|
+
private newImagePlaceholder;
|
|
493
586
|
private handleLinearElementOnPointerDown;
|
|
494
587
|
private getCurrentItemRoundness;
|
|
588
|
+
private getCurrentItemStrokeWidth;
|
|
495
589
|
private createGenericElementOnPointerDown;
|
|
496
590
|
private createFrameElementOnPointerDown;
|
|
497
591
|
private maybeCacheReferenceSnapPoints;
|
|
@@ -510,11 +604,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
510
604
|
* and when you don't want to loose those modifications
|
|
511
605
|
*/
|
|
512
606
|
private getLatestInitializedImageElement;
|
|
513
|
-
|
|
514
|
-
* inserts image into elements array and rerenders
|
|
515
|
-
*/
|
|
516
|
-
private insertImageElement;
|
|
517
|
-
private onImageAction;
|
|
607
|
+
private onImageToolbarButtonClick;
|
|
518
608
|
private getImageNaturalDimensions;
|
|
519
609
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
520
610
|
to error for images that fail during <img> element creation */
|
|
@@ -524,12 +614,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
524
614
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
525
615
|
* to render new images. This is just a failsafe */
|
|
526
616
|
private scheduleImageRefresh;
|
|
527
|
-
private updateBindingEnabledOnPointerMove;
|
|
528
|
-
private maybeSuggestBindingAtCursor;
|
|
529
617
|
private clearSelection;
|
|
530
618
|
private handleInteractiveCanvasRef;
|
|
619
|
+
private insertImages;
|
|
531
620
|
private handleAppOnDrop;
|
|
532
|
-
loadFileToCanvas: (file: File, fileHandle:
|
|
621
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
|
|
533
622
|
private handleCanvasContextMenu;
|
|
534
623
|
private maybeDragNewGenericElement;
|
|
535
624
|
private maybeHandleCrop;
|
|
@@ -542,6 +631,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
542
631
|
private updateDOMRect;
|
|
543
632
|
refresh: () => void;
|
|
544
633
|
private getCanvasOffsets;
|
|
634
|
+
watchState: () => void;
|
|
545
635
|
private updateLanguage;
|
|
546
636
|
}
|
|
547
637
|
declare global {
|
|
@@ -551,6 +641,7 @@ declare global {
|
|
|
551
641
|
elements: readonly ExcalidrawElement[];
|
|
552
642
|
state: AppState;
|
|
553
643
|
setState: React.Component<any, AppState>["setState"];
|
|
644
|
+
watchState: (prev: any, next: any) => void | undefined;
|
|
554
645
|
app: InstanceType<typeof App>;
|
|
555
646
|
history: History;
|
|
556
647
|
store: Store;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { PendingExcalidrawElements } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Captures the App state management for the flowchart functionality.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppFlowchart {
|
|
8
|
+
private app;
|
|
9
|
+
private creator;
|
|
10
|
+
private navigator;
|
|
11
|
+
constructor(app: App);
|
|
12
|
+
get pendingNodes(): PendingExcalidrawElements | null;
|
|
13
|
+
get isCreatingChart(): boolean;
|
|
14
|
+
handleKeyEvent: (event: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
15
|
+
private resolveKeyboardEventToOperation;
|
|
16
|
+
private selectAndReveal;
|
|
17
|
+
private captureUpdate;
|
|
18
|
+
private static getLinkDirectionFromKey;
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AppState, UnsubscribeCallback } from "../types";
|
|
2
|
+
type StateChangeSelector = keyof AppState | (keyof AppState)[] | ((appState: AppState) => unknown);
|
|
3
|
+
export type OnStateChange = {
|
|
4
|
+
<K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void, opts?: {
|
|
5
|
+
once: boolean;
|
|
6
|
+
}): UnsubscribeCallback;
|
|
7
|
+
<K extends keyof AppState>(prop: K): Promise<AppState[K]>;
|
|
8
|
+
(prop: (keyof AppState)[], callback: (appState: AppState, appState2: AppState) => void, opts?: {
|
|
9
|
+
once: boolean;
|
|
10
|
+
}): UnsubscribeCallback;
|
|
11
|
+
(prop: (keyof AppState)[]): Promise<AppState>;
|
|
12
|
+
<T>(prop: (appState: AppState) => T, callback: (value: T, appState: AppState) => void, opts?: {
|
|
13
|
+
once: boolean;
|
|
14
|
+
}): UnsubscribeCallback;
|
|
15
|
+
<T>(prop: (appState: AppState) => T): Promise<T>;
|
|
16
|
+
(opts: {
|
|
17
|
+
predicate: (appState: AppState) => boolean;
|
|
18
|
+
callback: (appState: AppState) => void;
|
|
19
|
+
once?: boolean;
|
|
20
|
+
}): UnsubscribeCallback;
|
|
21
|
+
(opts: {
|
|
22
|
+
predicate: (appState: AppState) => boolean;
|
|
23
|
+
}): Promise<AppState>;
|
|
24
|
+
(selector: StateChangeSelector, callback: (value: any, appState: AppState) => void): any;
|
|
25
|
+
};
|
|
26
|
+
export declare class AppStateObserver {
|
|
27
|
+
private readonly getState;
|
|
28
|
+
private listeners;
|
|
29
|
+
constructor(getState: () => AppState);
|
|
30
|
+
private isStateChangePredicateOptions;
|
|
31
|
+
private subscribe;
|
|
32
|
+
private normalize;
|
|
33
|
+
onStateChange: OnStateChange;
|
|
34
|
+
flush(prevState: AppState): void;
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { ColorPickerType } from "./colorPickerUtils";
|
|
2
|
-
|
|
2
|
+
export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: {
|
|
3
3
|
color: string;
|
|
4
4
|
onChange: (color: string) => void;
|
|
5
5
|
label: string;
|
|
6
6
|
colorPickerType: ColorPickerType;
|
|
7
7
|
placeholder?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,7 @@ import type { ColorTuple, ColorPaletteCustom } from "@excalidraw/common";
|
|
|
2
2
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import "./ColorPicker.scss";
|
|
4
4
|
import type { ColorPickerType } from "./colorPickerUtils";
|
|
5
|
-
import type {
|
|
6
|
-
export declare const getColor: (color: string) => string | null;
|
|
5
|
+
import type { UIAppState } from "../../types";
|
|
7
6
|
interface ColorPickerProps {
|
|
8
7
|
type: ColorPickerType;
|
|
9
8
|
/**
|
|
@@ -14,7 +13,7 @@ interface ColorPickerProps {
|
|
|
14
13
|
onChange: (color: string) => void;
|
|
15
14
|
label: string;
|
|
16
15
|
elements: readonly ExcalidrawElement[];
|
|
17
|
-
appState:
|
|
16
|
+
appState: UIAppState;
|
|
18
17
|
palette?: ColorPaletteCustom | null;
|
|
19
18
|
topPicks?: ColorTuple;
|
|
20
19
|
updateData: (formData?: any) => void;
|