@excalidraw/math 0.18.0-51ad895 → 0.18.0-51ca8ab
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 +44 -10
- package/dist/dev/index.js.map +2 -2
- 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 +26 -18
- package/dist/types/common/src/editorInterface.d.ts +1 -1
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +4 -1
- 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 +40 -76
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +10 -6
- 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 +19 -12
- package/dist/types/element/src/bounds.d.ts +24 -17
- package/dist/types/element/src/collision.d.ts +4 -3
- package/dist/types/element/src/comparisons.d.ts +8 -7
- 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 +4 -0
- package/dist/types/element/src/linearElementEditor.d.ts +8 -4
- 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/renderElement.d.ts +0 -6
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +1 -1
- 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/textElement.d.ts +1 -1
- 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 +3 -23
- package/dist/types/element/src/typeChecks.d.ts +3 -4
- package/dist/types/element/src/types.d.ts +11 -2
- package/dist/types/element/src/utils.d.ts +9 -5
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +152 -207
- package/dist/types/excalidraw/actions/actionAlign.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +79 -116
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +413 -977
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +111 -148
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +38 -57
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +121 -178
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +50 -73
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +79 -116
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +54 -73
- package/dist/types/excalidraw/actions/actionExport.d.ts +116 -469
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -2
- package/dist/types/excalidraw/actions/actionFlip.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionFrame.d.ts +236 -344
- package/dist/types/excalidraw/actions/actionGroup.d.ts +83 -128
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +122 -174
- package/dist/types/excalidraw/actions/actionLink.d.ts +56 -75
- package/dist/types/excalidraw/actions/actionMenu.d.ts +44 -67
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -17
- package/dist/types/excalidraw/actions/actionProperties.d.ts +104 -132
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +41 -64
- package/dist/types/excalidraw/actions/actionStyles.d.ts +37 -55
- 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 +54 -73
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +54 -73
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +44 -67
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +53 -72
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +54 -73
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +54 -73
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/index.d.ts +4 -1
- package/dist/types/excalidraw/actions/manager.d.ts +1 -1
- 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 +1 -1
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +23 -19
- 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 +13 -38
- package/dist/types/excalidraw/components/Actions.d.ts +1 -1
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +135 -79
- 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/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +3 -3
- 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 +1 -0
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +2 -2
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- 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/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -1
- 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/PropertiesPopover.d.ts +1 -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/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/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/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/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
- 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 +48 -38
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -6
- 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 +41 -21
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +24 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -32
- package/dist/types/excalidraw/components/shapes.d.ts +81 -1
- package/dist/types/excalidraw/data/blob.d.ts +330 -7
- 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 +172 -4
- 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/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/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- 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 +5 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -4
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +428 -18
- package/dist/types/excalidraw/scene/export.d.ts +2 -2
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +7 -2
- 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 +264 -25
- package/dist/types/excalidraw/viewport.d.ts +316 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +7 -3
- 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 +3 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +5 -5
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/package.json +2 -2
- package/dist/types/common/src/visualdebug.d.ts +0 -41
- 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/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -22
- 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 -46
- 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
|
@@ -2,15 +2,12 @@ import { ALLOWED_PASTE_MIME_TYPES } from "@excalidraw/common";
|
|
|
2
2
|
import type { ValueOf } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { IMAGE_MIME_TYPES, STRING_MIME_TYPES } from "@excalidraw/common";
|
|
4
4
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
5
|
-
import type { FileSystemHandle } from "./data/filesystem";
|
|
6
|
-
import type { Spreadsheet } from "./charts";
|
|
7
5
|
import type { BinaryFiles } from "./types";
|
|
8
6
|
export type PastedMixedContent = {
|
|
9
7
|
type: "text" | "imageUrl";
|
|
10
8
|
value: string;
|
|
11
9
|
}[];
|
|
12
10
|
export interface ClipboardData {
|
|
13
|
-
spreadsheet?: Spreadsheet;
|
|
14
11
|
elements?: readonly ExcalidrawElement[];
|
|
15
12
|
files?: BinaryFiles;
|
|
16
13
|
text?: string;
|
|
@@ -23,26 +20,16 @@ export declare const probablySupportsClipboardReadText: boolean;
|
|
|
23
20
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
24
21
|
export declare const probablySupportsClipboardBlob: boolean;
|
|
25
22
|
export declare const createPasteEvent: ({ types, files, }: {
|
|
26
|
-
types?: {
|
|
27
|
-
|
|
28
|
-
"text/html"?: string | File | undefined;
|
|
29
|
-
"image/svg+xml"?: string | File | undefined;
|
|
30
|
-
"image/png"?: string | File | undefined;
|
|
31
|
-
"image/jpeg"?: string | File | undefined;
|
|
32
|
-
"image/gif"?: string | File | undefined;
|
|
33
|
-
"image/webp"?: string | File | undefined;
|
|
34
|
-
"image/bmp"?: string | File | undefined;
|
|
35
|
-
"image/x-icon"?: string | File | undefined;
|
|
36
|
-
"image/avif"?: string | File | undefined;
|
|
37
|
-
"image/jfif"?: string | File | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
files?: File[] | undefined;
|
|
23
|
+
types?: { [key in AllowedPasteMimeTypes]?: string | File; };
|
|
24
|
+
files?: File[];
|
|
40
25
|
}) => ClipboardEvent;
|
|
41
26
|
export declare const serializeAsClipboardJSON: ({ elements, files, }: {
|
|
42
27
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
43
28
|
files: BinaryFiles | null;
|
|
44
29
|
}) => string;
|
|
45
|
-
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null,
|
|
30
|
+
export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null,
|
|
31
|
+
/** supply if available to make the operation more certain to succeed */
|
|
32
|
+
clipboardEvent?: ClipboardEvent | null) => Promise<void>;
|
|
46
33
|
/**
|
|
47
34
|
* Reads OS clipboard programmatically. May not work on all browsers.
|
|
48
35
|
* Will prompt user for permission if not granted.
|
|
@@ -64,7 +51,7 @@ type AllowedParsedDataTransferItem = {
|
|
|
64
51
|
type: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
65
52
|
kind: "file";
|
|
66
53
|
file: File;
|
|
67
|
-
fileHandle:
|
|
54
|
+
fileHandle: FileSystemFileHandle | null;
|
|
68
55
|
} | {
|
|
69
56
|
type: ValueOf<typeof STRING_MIME_TYPES>;
|
|
70
57
|
kind: "string";
|
|
@@ -74,7 +61,7 @@ type ParsedDataTransferItem = {
|
|
|
74
61
|
type: string;
|
|
75
62
|
kind: "file";
|
|
76
63
|
file: File;
|
|
77
|
-
fileHandle:
|
|
64
|
+
fileHandle: FileSystemFileHandle | null;
|
|
78
65
|
} | {
|
|
79
66
|
type: string;
|
|
80
67
|
kind: "string";
|
|
@@ -86,7 +73,7 @@ type ParsedDataTransferItemType<T extends AllowedParsedDataTransferItem["type"]>
|
|
|
86
73
|
export type ParsedDataTransferFile = Extract<AllowedParsedDataTransferItem, {
|
|
87
74
|
kind: "file";
|
|
88
75
|
}>;
|
|
89
|
-
type ParsedDataTranferList = ParsedDataTransferItem[] & {
|
|
76
|
+
export type ParsedDataTranferList = ParsedDataTransferItem[] & {
|
|
90
77
|
/**
|
|
91
78
|
* Only allows filtering by known `string` data types, since `file`
|
|
92
79
|
* types can have multiple items of the same type (e.g. multiple image files)
|
|
@@ -101,29 +88,17 @@ type ParsedDataTranferList = ParsedDataTransferItem[] & {
|
|
|
101
88
|
getData: typeof getDataTransferItemData;
|
|
102
89
|
getFiles: typeof getDataTransferFiles;
|
|
103
90
|
};
|
|
104
|
-
declare const findDataTransferItemType: <T extends ValueOf<
|
|
105
|
-
|
|
106
|
-
readonly html: "text/html";
|
|
107
|
-
readonly json: "application/json";
|
|
108
|
-
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
109
|
-
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
110
|
-
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
111
|
-
}>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
|
|
112
|
-
declare const getDataTransferItemData: <T extends ValueOf<{
|
|
113
|
-
readonly text: "text/plain";
|
|
114
|
-
readonly html: "text/html";
|
|
115
|
-
readonly json: "application/json";
|
|
116
|
-
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
117
|
-
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
118
|
-
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
119
|
-
}>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
|
|
91
|
+
declare const findDataTransferItemType: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
|
|
92
|
+
declare const getDataTransferItemData: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
|
|
120
93
|
declare const getDataTransferFiles: (this: ParsedDataTranferList) => ParsedDataTransferFile[];
|
|
94
|
+
/** @returns list of MIME types, synchronously */
|
|
95
|
+
export declare const parseDataTransferEventMimeTypes: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Set<string>;
|
|
121
96
|
export declare const parseDataTransferEvent: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Promise<ParsedDataTranferList>;
|
|
122
97
|
/**
|
|
123
98
|
* Attempts to parse clipboard event.
|
|
124
99
|
*/
|
|
125
100
|
export declare const parseClipboard: (dataList: ParsedDataTranferList, isPlainPaste?: boolean) => Promise<ClipboardData>;
|
|
126
101
|
export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
|
|
127
|
-
export declare const copyTextToSystemClipboard: (text: string | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
|
|
102
|
+
export declare const copyTextToSystemClipboard: <MimeType extends ValueOf<typeof STRING_MIME_TYPES>>(text: string | { [K in MimeType]: string; } | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
|
|
128
103
|
export declare const isClipboardEvent: (event: React.SyntheticEvent | Event) => event is ClipboardEvent;
|
|
129
104
|
export {};
|
|
@@ -36,7 +36,7 @@ export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
|
36
36
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export declare const UndoRedoActions: ({ renderAction, className, }: {
|
|
38
38
|
renderAction: ActionManager["renderAction"];
|
|
39
|
-
className?: string
|
|
39
|
+
className?: string;
|
|
40
40
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
41
41
|
export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
|
|
42
42
|
actionManager: ActionManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const activeConfirmDialogAtom: import("jotai
|
|
1
|
+
export declare const activeConfirmDialogAtom: import("jotai").PrimitiveAtom<"clearCanvas" | null> & {
|
|
2
2
|
init: "clearCanvas" | null;
|
|
3
3
|
};
|
|
4
4
|
export declare const ActiveConfirmDialog: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
2
|
+
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
3
|
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
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 { type OnStateChange } from "./AppStateObserver";
|
|
15
17
|
import type { ExportedElements } from "../data";
|
|
16
|
-
import type {
|
|
17
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, 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, ViewportOffsetsOptions } 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
43
|
export declare const useEditorInterface: () => Readonly<{
|
|
@@ -28,7 +45,7 @@ export declare const useEditorInterface: () => Readonly<{
|
|
|
28
45
|
desktopUIMode: "compact" | "full";
|
|
29
46
|
userAgent: Readonly<{
|
|
30
47
|
isMobileDevice: boolean;
|
|
31
|
-
platform: "
|
|
48
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
32
49
|
}>;
|
|
33
50
|
isTouchScreen: boolean;
|
|
34
51
|
canFitSidebar: boolean;
|
|
@@ -43,14 +60,25 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
|
|
|
43
60
|
export declare const useExcalidrawAppState: () => AppState;
|
|
44
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;
|
|
45
62
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
63
|
+
/**
|
|
64
|
+
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
|
|
65
|
+
*/
|
|
66
|
+
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
|
|
46
67
|
declare class App extends React.Component<AppProps, AppState> {
|
|
47
68
|
canvas: AppClassProperties["canvas"];
|
|
48
69
|
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
70
|
+
sessionExportThemeOverride: AppState["theme"] | undefined;
|
|
49
71
|
rc: RoughCanvas;
|
|
50
72
|
unmounted: boolean;
|
|
51
73
|
actionManager: ActionManager;
|
|
52
74
|
editorInterface: EditorInterface;
|
|
53
75
|
private stylesPanelMode;
|
|
76
|
+
/**
|
|
77
|
+
* Last-measured footprints of named viewport UI surfaces
|
|
78
|
+
* (`data-viewport-ui-name`), so `getViewportOffsets` can reserve space
|
|
79
|
+
* for them while they're hidden.
|
|
80
|
+
*/
|
|
81
|
+
private viewportUILastMeasured;
|
|
54
82
|
private excalidrawContainerRef;
|
|
55
83
|
scene: Scene;
|
|
56
84
|
fonts: Fonts;
|
|
@@ -79,24 +107,35 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
79
107
|
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
|
|
80
108
|
* insert to DOM before user initially scrolls to them) */
|
|
81
109
|
private initializedEmbeds;
|
|
82
|
-
private handleToastClose;
|
|
83
110
|
private elementsPendingErasure;
|
|
111
|
+
private _initialized;
|
|
112
|
+
private readonly editorLifecycleEvents;
|
|
113
|
+
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
|
|
114
|
+
private appStateObserver;
|
|
115
|
+
onStateChange: OnStateChange;
|
|
84
116
|
flowChartCreator: FlowChartCreator;
|
|
85
117
|
private flowChartNavigator;
|
|
86
118
|
bindModeHandler: ReturnType<typeof setTimeout> | null;
|
|
87
119
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
88
120
|
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
|
|
89
121
|
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
122
|
+
lastPointerUpIsDoubleClick: boolean;
|
|
90
123
|
lastPointerMoveEvent: PointerEvent | null;
|
|
124
|
+
/** current frame pointer cords */
|
|
91
125
|
lastPointerMoveCoords: {
|
|
92
126
|
x: number;
|
|
93
127
|
y: number;
|
|
94
128
|
} | null;
|
|
129
|
+
private lastCompletedCanvasClicks;
|
|
130
|
+
/** previous frame pointer coords */
|
|
131
|
+
previousPointerMoveCoords: {
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
} | null;
|
|
95
135
|
lastViewportPosition: {
|
|
96
136
|
x: number;
|
|
97
137
|
y: number;
|
|
98
138
|
};
|
|
99
|
-
animationFrameHandler: AnimationFrameHandler;
|
|
100
139
|
laserTrails: LaserTrails;
|
|
101
140
|
eraserTrail: EraserTrail;
|
|
102
141
|
lassoTrail: LassoTrail;
|
|
@@ -114,11 +153,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
114
153
|
x: number;
|
|
115
154
|
y: number;
|
|
116
155
|
}>;
|
|
117
|
-
scrollbars:
|
|
118
|
-
isOverEither: boolean;
|
|
119
|
-
isOverHorizontal: boolean;
|
|
120
|
-
isOverVertical: boolean;
|
|
121
|
-
};
|
|
156
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
122
157
|
lastCoords: {
|
|
123
158
|
x: number;
|
|
124
159
|
y: number;
|
|
@@ -131,7 +166,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
131
166
|
x: number;
|
|
132
167
|
y: number;
|
|
133
168
|
};
|
|
134
|
-
arrowDirection: "
|
|
169
|
+
arrowDirection: "origin" | "end";
|
|
135
170
|
center: {
|
|
136
171
|
x: number;
|
|
137
172
|
y: number;
|
|
@@ -158,14 +193,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
158
193
|
blockDragging: boolean;
|
|
159
194
|
};
|
|
160
195
|
eventListeners: {
|
|
161
|
-
onMove:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} | null;
|
|
166
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
167
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
168
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
196
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
197
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
198
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
199
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
169
200
|
};
|
|
170
201
|
boxSelection: {
|
|
171
202
|
hasOccurred: boolean;
|
|
@@ -184,11 +215,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
184
215
|
x: number;
|
|
185
216
|
y: number;
|
|
186
217
|
}>;
|
|
187
|
-
scrollbars:
|
|
188
|
-
isOverEither: boolean;
|
|
189
|
-
isOverHorizontal: boolean;
|
|
190
|
-
isOverVertical: boolean;
|
|
191
|
-
};
|
|
218
|
+
scrollbars: ReturnType<typeof isOverScrollBars>;
|
|
192
219
|
lastCoords: {
|
|
193
220
|
x: number;
|
|
194
221
|
y: number;
|
|
@@ -201,7 +228,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
201
228
|
x: number;
|
|
202
229
|
y: number;
|
|
203
230
|
};
|
|
204
|
-
arrowDirection: "
|
|
231
|
+
arrowDirection: "origin" | "end";
|
|
205
232
|
center: {
|
|
206
233
|
x: number;
|
|
207
234
|
y: number;
|
|
@@ -228,14 +255,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
228
255
|
blockDragging: boolean;
|
|
229
256
|
};
|
|
230
257
|
eventListeners: {
|
|
231
|
-
onMove:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
} | null;
|
|
236
|
-
onUp: ((event: PointerEvent) => void) | null;
|
|
237
|
-
onKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
238
|
-
onKeyUp: ((event: KeyboardEvent) => void) | null;
|
|
258
|
+
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
|
|
259
|
+
onUp: null | ((event: PointerEvent) => void);
|
|
260
|
+
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
261
|
+
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
239
262
|
};
|
|
240
263
|
boxSelection: {
|
|
241
264
|
hasOccurred: boolean;
|
|
@@ -247,6 +270,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
247
270
|
}>]>;
|
|
248
271
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
249
272
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
273
|
+
api: ExcalidrawImperativeAPI;
|
|
274
|
+
private createExcalidrawAPI;
|
|
250
275
|
constructor(props: AppProps);
|
|
251
276
|
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
252
277
|
private onWindowMessage;
|
|
@@ -260,8 +285,12 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
260
285
|
* If disabled, returns null.
|
|
261
286
|
*/
|
|
262
287
|
getEffectiveGridSize: () => NullableGridSize;
|
|
288
|
+
private getTextCreationGridPoint;
|
|
263
289
|
private getHTMLIFrameElement;
|
|
264
|
-
private
|
|
290
|
+
private handleIframeLikeElementHover;
|
|
291
|
+
/** @returns true if iframe-like element click handled */
|
|
292
|
+
private handleIframeLikeCenterClick;
|
|
293
|
+
private isDoubleClick;
|
|
265
294
|
private isIframeLikeElementCenter;
|
|
266
295
|
private updateEmbedValidationStatus;
|
|
267
296
|
private updateEmbeddables;
|
|
@@ -274,7 +303,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
274
303
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
275
304
|
focusContainer: AppClassProperties["focusContainer"];
|
|
276
305
|
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
277
|
-
getSceneElementsMapIncludingDeleted: () =>
|
|
306
|
+
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
|
|
278
307
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
279
308
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
280
309
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
@@ -336,54 +365,57 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
336
365
|
clientY: number;
|
|
337
366
|
} | "cursor" | "center";
|
|
338
367
|
retainSeed?: boolean;
|
|
339
|
-
|
|
368
|
+
fit?: SetViewportOptions["fit"];
|
|
369
|
+
preserveFrameChildrenOrder?: boolean;
|
|
340
370
|
}) => void;
|
|
341
371
|
private addElementsFromMixedContentPaste;
|
|
342
372
|
private addTextFromPaste;
|
|
343
373
|
setAppState: React.Component<any, AppState>["setState"];
|
|
344
374
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
345
375
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
346
|
-
updateFrameRendering: (opts: Partial<
|
|
347
|
-
enabled: boolean;
|
|
348
|
-
name: boolean;
|
|
349
|
-
outline: boolean;
|
|
350
|
-
clip: boolean;
|
|
351
|
-
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
376
|
+
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
352
377
|
togglePenMode: (force: boolean | null) => void;
|
|
353
378
|
onHandToolToggle: () => void;
|
|
354
379
|
/**
|
|
355
380
|
* Zooms on canvas viewport center
|
|
356
381
|
*/
|
|
357
|
-
zoomCanvas: (
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
382
|
+
zoomCanvas: (
|
|
383
|
+
/**
|
|
384
|
+
* Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
|
|
385
|
+
* 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
|
|
386
|
+
*/
|
|
387
|
+
value: number) => void;
|
|
388
|
+
/**
|
|
389
|
+
* Navigates the viewport to a target and, optionally, locks pan/zoom to it.
|
|
390
|
+
* The resolved target box drives both the navigation (pan + zoom per
|
|
391
|
+
* `fit`) and the lock: the operations chain — the viewport animates onto
|
|
392
|
+
* the target, then the lock is installed against the settled viewport.
|
|
393
|
+
*
|
|
394
|
+
* Passing `null` clears any active lock without navigating.
|
|
395
|
+
*/
|
|
396
|
+
/**
|
|
397
|
+
* Resolves user-supplied viewport offsets ({@link ViewportOffsets}) into
|
|
398
|
+
* concrete per-side pixel values: static sides are used as-is, and when
|
|
399
|
+
* `ui` is set, the remaining sides are derived from the currently
|
|
400
|
+
* rendered editor UI (via `getViewportOffsets`).
|
|
401
|
+
*
|
|
402
|
+
* Must be called at the time the offsets are applied (not e.g. cached at
|
|
403
|
+
* props-definition time), so the UI-derived values reflect the actual
|
|
404
|
+
* rendered UI.
|
|
405
|
+
*/
|
|
406
|
+
private resolveViewportOffsets;
|
|
407
|
+
setViewport: (opts: SetViewportOptions | null) => void;
|
|
379
408
|
private maybeUnfollowRemoteUser;
|
|
380
409
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
381
410
|
private translateCanvas;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
411
|
+
/** clamps scroll/zoom back into `appState.scrollConstraints` (no-op when
|
|
412
|
+
* unconstrained). Runs as a queued update, so it sees the preceding change.
|
|
413
|
+
* `overscroll` (screen px) relaxes the bounds for rubberbanding. */
|
|
414
|
+
private constrainViewportToScrollConstraints;
|
|
415
|
+
/** animates an overscrolled viewport back inside the constraint box */
|
|
416
|
+
private snapBackToScrollConstraints;
|
|
417
|
+
private snapBackToScrollConstraintsDebounced;
|
|
418
|
+
setToast: (toast: AppState["toast"]) => void;
|
|
387
419
|
restoreFileFromShare: () => Promise<void>;
|
|
388
420
|
/**
|
|
389
421
|
* adds supplied files to existing files in the appState.
|
|
@@ -393,7 +425,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
393
425
|
private addMissingFiles;
|
|
394
426
|
updateScene: <K extends keyof AppState>(sceneData: {
|
|
395
427
|
elements?: SceneData["elements"];
|
|
396
|
-
appState?: Pick<AppState, K> | null
|
|
428
|
+
appState?: Pick<AppState, K> | null;
|
|
397
429
|
collaborators?: SceneData["collaborators"];
|
|
398
430
|
/**
|
|
399
431
|
* 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.
|
|
@@ -416,11 +448,21 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
416
448
|
*/
|
|
417
449
|
toggleSidebar: ({ name, tab, force, }: {
|
|
418
450
|
name: SidebarName | null;
|
|
419
|
-
tab?:
|
|
420
|
-
force?: boolean
|
|
451
|
+
tab?: SidebarTabName;
|
|
452
|
+
force?: boolean;
|
|
421
453
|
}) => boolean;
|
|
422
454
|
private updateCurrentCursorPosition;
|
|
423
|
-
|
|
455
|
+
/**
|
|
456
|
+
* top/right/bottom/left override the final offsets for those sides.
|
|
457
|
+
*
|
|
458
|
+
* Default side offsets are measured from the currently rendered UI
|
|
459
|
+
* surfaces marked with the `data-viewport-ui` attribute (see
|
|
460
|
+
* {@link ViewportUIDock}), plus padding.
|
|
461
|
+
*
|
|
462
|
+
* See {@link ViewportOffsetsOptions} for the individual options
|
|
463
|
+
* (padding, per-side overrides, reserving space for hidden surfaces).
|
|
464
|
+
*/
|
|
465
|
+
getViewportOffsets: (opts?: ViewportOffsetsOptions) => Offsets;
|
|
424
466
|
private onKeyDown;
|
|
425
467
|
private onKeyUp;
|
|
426
468
|
private isToolSupported;
|
|
@@ -449,7 +491,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
449
491
|
private onGestureEnd;
|
|
450
492
|
private handleTextWysiwyg;
|
|
451
493
|
private deselectElements;
|
|
494
|
+
private getSelectedTextElement;
|
|
495
|
+
private getSelectedTextEditingContainerAtPosition;
|
|
452
496
|
private getTextElementAtPosition;
|
|
497
|
+
private isHittingTextAutoResizeHandle;
|
|
498
|
+
private handleTextAutoResizeHandlePointerDown;
|
|
453
499
|
private getElementAtPosition;
|
|
454
500
|
private getElementsAtPosition;
|
|
455
501
|
getElementHitThreshold(element: ExcalidrawElement): number;
|
|
@@ -458,10 +504,20 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
458
504
|
private startTextEditing;
|
|
459
505
|
private startImageCropping;
|
|
460
506
|
private finishImageCropping;
|
|
507
|
+
private shouldHandleBrowserCanvasDoubleClick;
|
|
461
508
|
private handleCanvasDoubleClick;
|
|
509
|
+
private handleCanvasClick;
|
|
462
510
|
private getElementLinkAtPosition;
|
|
463
|
-
private
|
|
511
|
+
private handleElementLinkClick;
|
|
512
|
+
/**
|
|
513
|
+
* finds candidate frame under cursor (when dragging frame children/elements
|
|
514
|
+
* inside frames)
|
|
515
|
+
*/
|
|
464
516
|
private getTopLayerFrameAtSceneCoords;
|
|
517
|
+
private updateFrameToHighlight;
|
|
518
|
+
private maybeUpdateFrameToHighlightOnPointerMove;
|
|
519
|
+
private insertNewElements;
|
|
520
|
+
private insertNewElement;
|
|
465
521
|
private handleCanvasPointerMove;
|
|
466
522
|
private handleEraser;
|
|
467
523
|
private handleTouchMove;
|
|
@@ -503,6 +559,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
503
559
|
private newImagePlaceholder;
|
|
504
560
|
private handleLinearElementOnPointerDown;
|
|
505
561
|
private getCurrentItemRoundness;
|
|
562
|
+
private getCurrentItemStrokeWidth;
|
|
506
563
|
private createGenericElementOnPointerDown;
|
|
507
564
|
private createFrameElementOnPointerDown;
|
|
508
565
|
private maybeCacheReferenceSnapPoints;
|
|
@@ -531,12 +588,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
531
588
|
/** generally you should use `addNewImagesToImageCache()` directly if you need
|
|
532
589
|
* to render new images. This is just a failsafe */
|
|
533
590
|
private scheduleImageRefresh;
|
|
534
|
-
private updateBindingEnabledOnPointerMove;
|
|
535
591
|
private clearSelection;
|
|
536
592
|
private handleInteractiveCanvasRef;
|
|
537
593
|
private insertImages;
|
|
538
594
|
private handleAppOnDrop;
|
|
539
|
-
loadFileToCanvas: (file: File, fileHandle:
|
|
595
|
+
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
|
|
540
596
|
private handleCanvasContextMenu;
|
|
541
597
|
private maybeDragNewGenericElement;
|
|
542
598
|
private maybeHandleCrop;
|
|
@@ -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
|
/**
|
|
@@ -14,8 +14,7 @@ export declare const isCustomColor: ({ color, palette, }: {
|
|
|
14
14
|
}) => boolean;
|
|
15
15
|
export declare const getMostUsedCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", palette: ColorPaletteCustom) => string[];
|
|
16
16
|
export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades" | "hex" | null;
|
|
17
|
-
export declare const activeColorPickerSectionAtom: import("jotai
|
|
17
|
+
export declare const activeColorPickerSectionAtom: import("jotai").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,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const toggleTheme: CommandPaletteItem;
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ActionManager } from "../../actions/manager";
|
|
3
2
|
import type { Action } from "../../actions/types";
|
|
4
3
|
export type CommandPaletteItem = {
|
|
@@ -15,7 +14,7 @@ export type CommandPaletteItem = {
|
|
|
15
14
|
category: string;
|
|
16
15
|
order?: number;
|
|
17
16
|
predicate?: boolean | Action["predicate"];
|
|
18
|
-
shortcut?: string;
|
|
17
|
+
shortcut?: string | null;
|
|
19
18
|
/** if false, command will not show while in view mode */
|
|
20
19
|
viewMode?: boolean;
|
|
21
20
|
perform: (data: {
|