@excalidraw/math 0.18.0-b16b6f8fd → 0.18.0-b2b2815
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 +92 -65
- package/dist/dev/index.js.map +3 -3
- 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 +59 -39
- package/dist/types/common/src/constants.d.ts +37 -26
- 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/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +53 -41
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +16 -8
- 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 +67 -48
- package/dist/types/element/src/bounds.d.ts +8 -14
- package/dist/types/element/src/collision.d.ts +7 -2
- package/dist/types/element/src/comparisons.d.ts +7 -7
- package/dist/types/element/src/delta.d.ts +16 -4
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/dragElements.d.ts +3 -3
- package/dist/types/element/src/duplicate.d.ts +4 -3
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +12 -7
- 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 +5 -3
- package/dist/types/element/src/linearElementEditor.d.ts +23 -22
- package/dist/types/element/src/mutateElement.d.ts +5 -1
- package/dist/types/element/src/newElement.d.ts +6 -6
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -7
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +10 -10
- package/dist/types/element/src/shape.d.ts +9 -8
- package/dist/types/element/src/store.d.ts +6 -1
- package/dist/types/element/src/textElement.d.ts +2 -2
- 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 +5 -7
- package/dist/types/element/src/types.d.ts +12 -13
- 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 +167 -207
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +94 -121
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +557 -914
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +123 -891
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +45 -59
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +148 -192
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +159 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +53 -73
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +92 -119
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionExport.d.ts +173 -1405
- 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 +265 -356
- package/dist/types/excalidraw/actions/actionGroup.d.ts +97 -132
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +138 -190
- package/dist/types/excalidraw/actions/actionLink.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionMenu.d.ts +48 -434
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +152 -2509
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -66
- package/dist/types/excalidraw/actions/actionStyles.d.ts +45 -58
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +47 -67
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +58 -72
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/index.d.ts +5 -2
- 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 +4 -4
- package/dist/types/excalidraw/appState.d.ts +29 -21
- 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 +22 -5
- package/dist/types/excalidraw/components/App.d.ts +127 -76
- 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 +0 -1
- 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 +0 -1
- 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/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- 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 +0 -1
- 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/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -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/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -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/PasteChartDialog.d.ts +4 -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/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/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
- 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/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
- 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 +25 -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 +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +49 -21
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +20 -2
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/shapes.d.ts +209 -1
- package/dist/types/excalidraw/data/blob.d.ts +327 -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 +4 -5
- package/dist/types/excalidraw/data/json.d.ts +170 -4
- package/dist/types/excalidraw/data/library.d.ts +24 -9
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +27 -7
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- 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/renderer/animation.d.ts +12 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
- package/dist/types/excalidraw/scene/Renderer.d.ts +427 -18
- package/dist/types/excalidraw/scene/export.d.ts +2 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
- package/dist/types/excalidraw/scene/types.d.ts +22 -5
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +5 -5
- 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 +134 -37
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +7 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -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 +7 -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/bbox.d.ts +1 -1
- package/dist/types/utils/src/export.d.ts +5 -5
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/dist/types/utils/src/withinBounds.d.ts +2 -2
- package/package.json +2 -2
- 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/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/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 -6
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
|
|
4
|
-
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
|
|
2
|
+
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
+
import { LinearElementEditor, FlowChartCreator, 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
7
|
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
@@ -10,30 +10,48 @@ import { Fonts } from "../fonts";
|
|
|
10
10
|
import { type WritableAtom } from "../editor-jotai";
|
|
11
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
12
|
import { LaserTrails } from "../laser-trails";
|
|
13
|
+
import { isOverScrollBars } from "../scene/scrollbars";
|
|
13
14
|
import { LassoTrail } from "../lasso";
|
|
14
15
|
import { EraserTrail } from "../eraser";
|
|
16
|
+
import { type OnStateChange } from "./AppStateObserver";
|
|
15
17
|
import type { ExportedElements } from "../data";
|
|
16
|
-
import type {
|
|
17
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
18
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
18
19
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
19
20
|
import type { ActionResult } from "../actions/types";
|
|
21
|
+
declare const editorLifecycleEventBehavior: {
|
|
22
|
+
readonly "editor:mount": {
|
|
23
|
+
readonly cardinality: "once";
|
|
24
|
+
readonly replay: "last";
|
|
25
|
+
};
|
|
26
|
+
readonly "editor:initialize": {
|
|
27
|
+
readonly cardinality: "once";
|
|
28
|
+
readonly replay: "last";
|
|
29
|
+
};
|
|
30
|
+
readonly "editor:unmount": {
|
|
31
|
+
readonly cardinality: "once";
|
|
32
|
+
readonly replay: "last";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
20
35
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
21
36
|
container: HTMLDivElement | null;
|
|
22
37
|
id: string | null;
|
|
23
38
|
}>;
|
|
39
|
+
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
|
|
40
|
+
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
|
|
24
41
|
export declare const useApp: () => AppClassProperties;
|
|
25
42
|
export declare const useAppProps: () => AppProps;
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
canFitSidebar: boolean;
|
|
34
|
-
};
|
|
43
|
+
export declare const useEditorInterface: () => Readonly<{
|
|
44
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
45
|
+
desktopUIMode: "compact" | "full";
|
|
46
|
+
userAgent: Readonly<{
|
|
47
|
+
isMobileDevice: boolean;
|
|
48
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
49
|
+
}>;
|
|
35
50
|
isTouchScreen: boolean;
|
|
51
|
+
canFitSidebar: boolean;
|
|
52
|
+
isLandscape: boolean;
|
|
36
53
|
}>;
|
|
54
|
+
export declare const useStylesPanelMode: () => StylesPanelMode;
|
|
37
55
|
export declare const useExcalidrawContainer: () => {
|
|
38
56
|
container: HTMLDivElement | null;
|
|
39
57
|
id: string | null;
|
|
@@ -42,20 +60,25 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
42
60
|
export declare const useExcalidrawAppState: () => AppState;
|
|
43
61
|
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
62
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
63
|
+
/**
|
|
64
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
65
|
+
*/
|
|
66
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
45
67
|
declare class App extends React.Component<AppProps, AppState> {
|
|
46
68
|
canvas: AppClassProperties["canvas"];
|
|
47
69
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
70
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
48
71
|
rc: RoughCanvas;
|
|
49
72
|
unmounted: boolean;
|
|
50
73
|
actionManager: ActionManager;
|
|
51
|
-
|
|
74
|
+
editorInterface: EditorInterface;
|
|
75
|
+
private stylesPanelMode;
|
|
52
76
|
private excalidrawContainerRef;
|
|
53
77
|
scene: Scene;
|
|
54
78
|
fonts: Fonts;
|
|
55
79
|
renderer: Renderer;
|
|
56
80
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
57
81
|
private resizeObserver;
|
|
58
|
-
private nearestScrollableContainer;
|
|
59
82
|
library: AppClassProperties["library"];
|
|
60
83
|
libraryItemsFromStorage: LibraryItems | undefined;
|
|
61
84
|
id: string;
|
|
@@ -78,18 +101,31 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
78
101
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
79
102
|
* insert to DOM before user initially scrolls to them) */
|
|
80
103
|
private initializedEmbeds;
|
|
81
|
-
private handleToastClose;
|
|
82
104
|
private elementsPendingErasure;
|
|
105
|
+
private _initialized;
|
|
106
|
+
private readonly editorLifecycleEvents;
|
|
107
|
+
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
108
|
+
private appStateObserver;
|
|
109
|
+
onStateChange: OnStateChange;
|
|
83
110
|
flowChartCreator: FlowChartCreator;
|
|
84
111
|
private flowChartNavigator;
|
|
112
|
+
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
85
113
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
86
114
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
87
115
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
116
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
88
117
|
lastPointerMoveEvent: PointerEvent | null;
|
|
118
|
+
/** current frame pointer cords */
|
|
89
119
|
lastPointerMoveCoords: {
|
|
90
120
|
x: number;
|
|
91
121
|
y: number;
|
|
92
122
|
} | null;
|
|
123
|
+
private lastCompletedCanvasClicks;
|
|
124
|
+
/** previous frame pointer coords */
|
|
125
|
+
previousPointerMoveCoords: {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
} | null;
|
|
93
129
|
lastViewportPosition: {
|
|
94
130
|
x: number;
|
|
95
131
|
y: number;
|
|
@@ -112,11 +148,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
112
148
|
x: number;
|
|
113
149
|
y: number;
|
|
114
150
|
}>;
|
|
115
|
-
scrollbars:
|
|
116
|
-
isOverEither: boolean;
|
|
117
|
-
isOverHorizontal: boolean;
|
|
118
|
-
isOverVertical: boolean;
|
|
119
|
-
};
|
|
151
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
120
152
|
lastCoords: {
|
|
121
153
|
x: number;
|
|
122
154
|
y: number;
|
|
@@ -129,7 +161,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
129
161
|
x: number;
|
|
130
162
|
y: number;
|
|
131
163
|
};
|
|
132
|
-
arrowDirection: "
|
|
164
|
+
arrowDirection: "origin" | "end";
|
|
133
165
|
center: {
|
|
134
166
|
x: number;
|
|
135
167
|
y: number;
|
|
@@ -153,16 +185,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
153
185
|
x: number;
|
|
154
186
|
y: number;
|
|
155
187
|
};
|
|
188
|
+
blockDragging: boolean;
|
|
156
189
|
};
|
|
157
190
|
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;
|
|
191
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
192
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
193
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
194
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
166
195
|
};
|
|
167
196
|
boxSelection: {
|
|
168
197
|
hasOccurred: boolean;
|
|
@@ -181,11 +210,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
181
210
|
x: number;
|
|
182
211
|
y: number;
|
|
183
212
|
}>;
|
|
184
|
-
scrollbars:
|
|
185
|
-
isOverEither: boolean;
|
|
186
|
-
isOverHorizontal: boolean;
|
|
187
|
-
isOverVertical: boolean;
|
|
188
|
-
};
|
|
213
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
189
214
|
lastCoords: {
|
|
190
215
|
x: number;
|
|
191
216
|
y: number;
|
|
@@ -198,7 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
198
223
|
x: number;
|
|
199
224
|
y: number;
|
|
200
225
|
};
|
|
201
|
-
arrowDirection: "
|
|
226
|
+
arrowDirection: "origin" | "end";
|
|
202
227
|
center: {
|
|
203
228
|
x: number;
|
|
204
229
|
y: number;
|
|
@@ -222,16 +247,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
222
247
|
x: number;
|
|
223
248
|
y: number;
|
|
224
249
|
};
|
|
250
|
+
blockDragging: boolean;
|
|
225
251
|
};
|
|
226
252
|
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;
|
|
253
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
254
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
255
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
256
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
235
257
|
};
|
|
236
258
|
boxSelection: {
|
|
237
259
|
hasOccurred: boolean;
|
|
@@ -243,17 +265,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
243
265
|
}>]>;
|
|
244
266
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
245
267
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
268
|
+
api: ExcalidrawImperativeAPI;
|
|
269
|
+
private createExcalidrawAPI;
|
|
246
270
|
constructor(props: AppProps);
|
|
247
271
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
248
272
|
private onWindowMessage;
|
|
273
|
+
private handleSkipBindMode;
|
|
274
|
+
private resetDelayedBindMode;
|
|
275
|
+
private previousHoveredBindableElement;
|
|
276
|
+
private handleDelayedBindModeChange;
|
|
249
277
|
private cacheEmbeddableRef;
|
|
250
278
|
/**
|
|
251
279
|
* Returns gridSize taking into account `gridModeEnabled`.
|
|
252
280
|
* If disabled, returns null.
|
|
253
281
|
*/
|
|
254
282
|
getEffectiveGridSize: () => NullableGridSize;
|
|
283
|
+
private getTextCreationGridPoint;
|
|
255
284
|
private getHTMLIFrameElement;
|
|
256
|
-
private
|
|
285
|
+
private handleIframeLikeElementHover;
|
|
286
|
+
/** @returns true if iframe-like element click handled */
|
|
287
|
+
private handleIframeLikeCenterClick;
|
|
288
|
+
private isDoubleClick;
|
|
257
289
|
private isIframeLikeElementCenter;
|
|
258
290
|
private updateEmbedValidationStatus;
|
|
259
291
|
private updateEmbeddables;
|
|
@@ -266,7 +298,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
266
298
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
267
299
|
focusContainer: AppClassProperties["focusContainer"];
|
|
268
300
|
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
269
|
-
getSceneElementsMapIncludingDeleted: () =>
|
|
301
|
+
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
|
|
270
302
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
271
303
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
272
304
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
@@ -297,9 +329,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
297
329
|
*/
|
|
298
330
|
private resetScene;
|
|
299
331
|
private initializeScene;
|
|
300
|
-
private
|
|
301
|
-
|
|
302
|
-
private
|
|
332
|
+
private getFormFactor;
|
|
333
|
+
refreshEditorInterface: () => void;
|
|
334
|
+
private reconcileStylesPanelMode;
|
|
335
|
+
/** TO BE USED LATER */
|
|
336
|
+
private setDesktopUIMode;
|
|
303
337
|
private clearImageShapeCache;
|
|
304
338
|
componentDidMount(): Promise<void>;
|
|
305
339
|
componentWillUnmount(): void;
|
|
@@ -316,6 +350,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
316
350
|
private static resetTapTwice;
|
|
317
351
|
private onTouchStart;
|
|
318
352
|
private onTouchEnd;
|
|
353
|
+
private insertClipboardContent;
|
|
319
354
|
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
|
|
320
355
|
addElementsFromPasteOrLibrary: (opts: {
|
|
321
356
|
elements: readonly ExcalidrawElement[];
|
|
@@ -326,26 +361,34 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
326
361
|
} | "cursor" | "center";
|
|
327
362
|
retainSeed?: boolean;
|
|
328
363
|
fitToContent?: boolean;
|
|
364
|
+
preserveFrameChildrenOrder?: boolean;
|
|
329
365
|
}) => void;
|
|
330
366
|
private addElementsFromMixedContentPaste;
|
|
331
367
|
private addTextFromPaste;
|
|
332
368
|
setAppState: React.Component<any, AppState>["setState"];
|
|
333
369
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
334
370
|
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;
|
|
371
|
+
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
341
372
|
togglePenMode: (force: boolean | null) => void;
|
|
342
373
|
onHandToolToggle: () => void;
|
|
343
374
|
/**
|
|
344
375
|
* Zooms on canvas viewport center
|
|
345
376
|
*/
|
|
346
|
-
zoomCanvas: (
|
|
377
|
+
zoomCanvas: (
|
|
378
|
+
/**
|
|
379
|
+
* Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
|
|
380
|
+
* 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
|
|
381
|
+
*/
|
|
382
|
+
value: number) => void;
|
|
347
383
|
private cancelInProgressAnimation;
|
|
348
|
-
scrollToContent: (
|
|
384
|
+
scrollToContent: (
|
|
385
|
+
/**
|
|
386
|
+
* target to scroll to
|
|
387
|
+
*
|
|
388
|
+
* - string - id of element or group, or url containing elementLink
|
|
389
|
+
* - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
|
|
390
|
+
*/
|
|
391
|
+
target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
|
|
349
392
|
fitToContent?: boolean;
|
|
350
393
|
fitToViewport?: never;
|
|
351
394
|
viewportZoomFactor?: number;
|
|
@@ -368,11 +411,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
368
411
|
private maybeUnfollowRemoteUser;
|
|
369
412
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
370
413
|
private translateCanvas;
|
|
371
|
-
setToast: (toast:
|
|
372
|
-
message: string;
|
|
373
|
-
closable?: boolean;
|
|
374
|
-
duration?: number;
|
|
375
|
-
} | null) => void;
|
|
414
|
+
setToast: (toast: AppState["toast"]) => void;
|
|
376
415
|
restoreFileFromShare: () => Promise<void>;
|
|
377
416
|
/**
|
|
378
417
|
* adds supplied files to existing files in the appState.
|
|
@@ -382,7 +421,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
382
421
|
private addMissingFiles;
|
|
383
422
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
384
423
|
elements?: SceneData["elements"];
|
|
385
|
-
appState?: Pick<AppState, K> | null
|
|
424
|
+
appState?: Pick<AppState, K> | null;
|
|
386
425
|
collaborators?: SceneData["collaborators"];
|
|
387
426
|
/**
|
|
388
427
|
* 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,6 +436,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
397
436
|
*/
|
|
398
437
|
captureUpdate?: SceneData["captureUpdate"];
|
|
399
438
|
}) => void;
|
|
439
|
+
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
400
440
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
401
441
|
private triggerRender;
|
|
402
442
|
/**
|
|
@@ -404,8 +444,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
404
444
|
*/
|
|
405
445
|
toggleSidebar: ({ name, tab, force, }: {
|
|
406
446
|
name: SidebarName | null;
|
|
407
|
-
tab?:
|
|
408
|
-
force?: boolean
|
|
447
|
+
tab?: SidebarTabName;
|
|
448
|
+
force?: boolean;
|
|
409
449
|
}) => boolean;
|
|
410
450
|
private updateCurrentCursorPosition;
|
|
411
451
|
getEditorUIOffsets: () => Offsets;
|
|
@@ -437,7 +477,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
437
477
|
private onGestureEnd;
|
|
438
478
|
private handleTextWysiwyg;
|
|
439
479
|
private deselectElements;
|
|
480
|
+
private getSelectedTextElement;
|
|
481
|
+
private getSelectedTextEditingContainerAtPosition;
|
|
440
482
|
private getTextElementAtPosition;
|
|
483
|
+
private isHittingTextAutoResizeHandle;
|
|
484
|
+
private handleTextAutoResizeHandlePointerDown;
|
|
441
485
|
private getElementAtPosition;
|
|
442
486
|
private getElementsAtPosition;
|
|
443
487
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
@@ -446,10 +490,20 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
446
490
|
private startTextEditing;
|
|
447
491
|
private startImageCropping;
|
|
448
492
|
private finishImageCropping;
|
|
493
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
449
494
|
private handleCanvasDoubleClick;
|
|
495
|
+
private handleCanvasClick;
|
|
450
496
|
private getElementLinkAtPosition;
|
|
451
|
-
private
|
|
497
|
+
private handleElementLinkClick;
|
|
498
|
+
/**
|
|
499
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
500
|
+
* inside frames)
|
|
501
|
+
*/
|
|
452
502
|
private getTopLayerFrameAtSceneCoords;
|
|
503
|
+
private updateFrameToHighlight;
|
|
504
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
505
|
+
private insertNewElements;
|
|
506
|
+
private insertNewElement;
|
|
453
507
|
private handleCanvasPointerMove;
|
|
454
508
|
private handleEraser;
|
|
455
509
|
private handleTouchMove;
|
|
@@ -488,7 +542,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
488
542
|
sceneY: number;
|
|
489
543
|
link: string;
|
|
490
544
|
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
|
|
491
|
-
private
|
|
545
|
+
private newImagePlaceholder;
|
|
492
546
|
private handleLinearElementOnPointerDown;
|
|
493
547
|
private getCurrentItemRoundness;
|
|
494
548
|
private createGenericElementOnPointerDown;
|
|
@@ -509,11 +563,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
509
563
|
* and when you don't want to loose those modifications
|
|
510
564
|
*/
|
|
511
565
|
private getLatestInitializedImageElement;
|
|
512
|
-
|
|
513
|
-
* inserts image into elements array and rerenders
|
|
514
|
-
*/
|
|
515
|
-
private insertImageElement;
|
|
516
|
-
private onImageAction;
|
|
566
|
+
private onImageToolbarButtonClick;
|
|
517
567
|
private getImageNaturalDimensions;
|
|
518
568
|
/** updates image cache, refreshing updated elements and/or setting status
|
|
519
569
|
to error for images that fail during <img> element creation */
|
|
@@ -523,12 +573,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
523
573
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
524
574
|
* to render new images. This is just a failsafe */
|
|
525
575
|
private scheduleImageRefresh;
|
|
526
|
-
private updateBindingEnabledOnPointerMove;
|
|
527
|
-
private maybeSuggestBindingAtCursor;
|
|
528
576
|
private clearSelection;
|
|
529
577
|
private handleInteractiveCanvasRef;
|
|
578
|
+
private insertImages;
|
|
530
579
|
private handleAppOnDrop;
|
|
531
|
-
loadFileToCanvas: (file: File, fileHandle:
|
|
580
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
|
|
532
581
|
private handleCanvasContextMenu;
|
|
533
582
|
private maybeDragNewGenericElement;
|
|
534
583
|
private maybeHandleCrop;
|
|
@@ -541,6 +590,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
541
590
|
private updateDOMRect;
|
|
542
591
|
refresh: () => void;
|
|
543
592
|
private getCanvasOffsets;
|
|
593
|
+
watchState: () => void;
|
|
544
594
|
private updateLanguage;
|
|
545
595
|
}
|
|
546
596
|
declare global {
|
|
@@ -550,6 +600,7 @@ declare global {
|
|
|
550
600
|
elements: readonly ExcalidrawElement[];
|
|
551
601
|
state: AppState;
|
|
552
602
|
setState: React.Component<any, AppState>["setState"];
|
|
603
|
+
watchState: (prev: any, next: any) => void | undefined;
|
|
553
604
|
app: InstanceType<typeof App>;
|
|
554
605
|
history: History;
|
|
555
606
|
store: Store;
|
|
@@ -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;
|
|
@@ -3,7 +3,6 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
|
3
3
|
import "./ColorPicker.scss";
|
|
4
4
|
import type { ColorPickerType } from "./colorPickerUtils";
|
|
5
5
|
import type { AppState } from "../../types";
|
|
6
|
-
export declare const getColor: (color: string) => string | null;
|
|
7
6
|
interface ColorPickerProps {
|
|
8
7
|
type: ColorPickerType;
|
|
9
8
|
/**
|
|
@@ -10,8 +10,10 @@ interface PickerProps {
|
|
|
10
10
|
palette: ColorPaletteCustom;
|
|
11
11
|
updateData: (formData?: any) => void;
|
|
12
12
|
children?: React.ReactNode;
|
|
13
|
+
showTitle?: boolean;
|
|
13
14
|
onEyeDropperToggle: (force?: boolean) => void;
|
|
14
15
|
onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
|
|
16
|
+
showHotKey?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
|
|
17
19
|
export {};
|
|
@@ -4,6 +4,7 @@ interface PickerColorListProps {
|
|
|
4
4
|
color: string | null;
|
|
5
5
|
onChange: (color: string) => void;
|
|
6
6
|
activeShade: number;
|
|
7
|
+
showHotKey?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const PickerColorList: ({ palette, color, onChange, activeShade, }: PickerColorListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const PickerColorList: ({ palette, color, onChange, activeShade, showHotKey, }: PickerColorListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export default PickerColorList;
|
|
@@ -3,6 +3,7 @@ interface ShadeListProps {
|
|
|
3
3
|
color: string | null;
|
|
4
4
|
onChange: (color: string) => void;
|
|
5
5
|
palette: ColorPaletteCustom;
|
|
6
|
+
showHotKey?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export declare const ShadeList: ({ color, onChange, palette }: ShadeListProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ShadeList: ({ color, onChange, palette, showHotKey, }: ShadeListProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -17,5 +17,4 @@ export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades
|
|
|
17
17
|
export declare const activeColorPickerSectionAtom: import("jotai/vanilla/atom").PrimitiveAtom<ActiveColorPickerSectionAtomType> & {
|
|
18
18
|
init: ActiveColorPickerSectionAtomType;
|
|
19
19
|
};
|
|
20
|
-
export declare const isColorDark: (color: string, threshold?: number) => boolean;
|
|
21
20
|
export type ColorPickerType = "canvasBackground" | "elementBackground" | "elementStroke";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ActionManager } from "../../actions/manager";
|
|
3
2
|
import type { Action } from "../../actions/types";
|
|
4
|
-
import type { UIAppState } from "../../types";
|
|
5
3
|
export type CommandPaletteItem = {
|
|
6
4
|
label: string;
|
|
7
5
|
/** additional keywords to match against
|
|
@@ -12,11 +10,11 @@ export type CommandPaletteItem = {
|
|
|
12
10
|
* (deburred name + keywords)
|
|
13
11
|
*/
|
|
14
12
|
haystack?: string;
|
|
15
|
-
icon?:
|
|
13
|
+
icon?: Action["icon"];
|
|
16
14
|
category: string;
|
|
17
15
|
order?: number;
|
|
18
16
|
predicate?: boolean | Action["predicate"];
|
|
19
|
-
shortcut?: string;
|
|
17
|
+
shortcut?: string | null;
|
|
20
18
|
/** if false, command will not show while in view mode */
|
|
21
19
|
viewMode?: boolean;
|
|
22
20
|
perform: (data: {
|
|
@@ -16,8 +16,8 @@ export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, b
|
|
|
16
16
|
type ConversionType = "generic" | "linear" | null;
|
|
17
17
|
export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
|
|
18
18
|
conversionType: ConversionType;
|
|
19
|
-
nextType?: ConvertibleTypes
|
|
20
|
-
direction?: "left" | "right"
|
|
19
|
+
nextType?: ConvertibleTypes;
|
|
20
|
+
direction?: "left" | "right";
|
|
21
21
|
}) => boolean;
|
|
22
22
|
export declare const getConversionTypeFromElements: (elements: ExcalidrawElement[]) => ConversionType;
|
|
23
23
|
export default ConvertElementTypePopup;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
|
3
2
|
import "../components/dropdownMenu/DropdownMenu.scss";
|
|
4
3
|
import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
|
|
5
4
|
export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
|
|
6
|
-
name:
|
|
7
|
-
children:
|
|
8
|
-
onStateChange?: (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
docked?: boolean | undefined;
|
|
14
|
-
className?: string | undefined;
|
|
15
|
-
__fallback?: boolean | undefined;
|
|
5
|
+
name: import("../types").SidebarName;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onStateChange?: (state: import("../types").AppState["openSidebar"]) => void;
|
|
8
|
+
onDock?: (docked: boolean) => void;
|
|
9
|
+
docked?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
__fallback?: boolean;
|
|
16
12
|
}, "name">, "children">, "onDock"> & {
|
|
17
13
|
/** pass `false` to disable docking */
|
|
18
14
|
onDock?: SidebarProps["onDock"] | false;
|
|
19
15
|
} & {
|
|
20
|
-
__fallback?: boolean
|
|
16
|
+
__fallback?: boolean;
|
|
21
17
|
}> & {
|
|
22
18
|
Trigger: import("react").FC<Omit<SidebarTriggerProps, "name"> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
23
|
-
__fallback?: boolean
|
|
19
|
+
__fallback?: boolean;
|
|
24
20
|
}>;
|
|
25
21
|
TabTriggers: {
|
|
26
22
|
({ children }: {
|
|
@@ -6,7 +6,7 @@ declare const ElementLinkDialog: ({ sourceElementId, onClose, appState, scene, g
|
|
|
6
6
|
sourceElementId: ExcalidrawElement["id"];
|
|
7
7
|
appState: UIAppState;
|
|
8
8
|
scene: Scene;
|
|
9
|
-
onClose?: (
|
|
9
|
+
onClose?: () => void;
|
|
10
10
|
generateLinkForSelection: AppProps["generateLinkForSelection"];
|
|
11
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default ElementLinkDialog;
|