@excalidraw/common 0.18.0-3bdaafe → 0.18.0-3c916c5
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 +1867 -345
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +3 -3
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +81 -39
- package/dist/types/common/src/constants.d.ts +103 -35
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +5 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +59 -78
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +12 -8
- package/dist/types/element/src/align.d.ts +5 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +30 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +145 -49
- package/dist/types/element/src/bounds.d.ts +34 -19
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +24 -3
- package/dist/types/element/src/comparisons.d.ts +10 -7
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +30 -2
- package/dist/types/element/src/distribute.d.ts +6 -2
- package/dist/types/element/src/dragElements.d.ts +37 -5
- package/dist/types/element/src/duplicate.d.ts +67 -6
- package/dist/types/element/src/elbowArrow.d.ts +7 -0
- package/dist/types/element/src/embeddable.d.ts +3 -2
- package/dist/types/element/src/flowchart.d.ts +9 -11
- package/dist/types/element/src/fractionalIndex.d.ts +4 -4
- package/dist/types/element/src/frame.d.ts +35 -12
- package/dist/types/element/src/groups.d.ts +10 -15
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +6 -13
- package/dist/types/element/src/index.d.ts +11 -4
- package/dist/types/element/src/linearElementEditor.d.ts +51 -30
- package/dist/types/element/src/listMarker.d.ts +39 -0
- package/dist/types/element/src/mutateElement.d.ts +6 -2
- package/dist/types/element/src/newElement.d.ts +61 -9
- package/dist/types/element/src/renderElement.d.ts +33 -12
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +24 -14
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +11 -17
- package/dist/types/element/src/shape.d.ts +38 -9
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +191 -0
- package/dist/types/element/src/textElement.d.ts +23 -11
- package/dist/types/element/src/textMeasurements.d.ts +16 -14
- package/dist/types/element/src/textWrapping.d.ts +28 -1
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +32 -9
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +30 -31
- package/dist/types/element/src/types.d.ts +55 -20
- package/dist/types/element/src/utils.d.ts +22 -6
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +248 -219
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +116 -272
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +578 -1611
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +177 -899
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +73 -64
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -562
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +80 -77
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +149 -130
- package/dist/types/excalidraw/actions/actionExport.d.ts +229 -1415
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +247 -875
- package/dist/types/excalidraw/actions/actionGroup.d.ts +160 -149
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +261 -238
- package/dist/types/excalidraw/actions/actionLink.d.ts +86 -77
- package/dist/types/excalidraw/actions/actionMenu.d.ts +75 -438
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +238 -2533
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +80 -75
- package/dist/types/excalidraw/actions/actionStyles.d.ts +74 -64
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +195 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +88 -80
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +87 -78
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +76 -74
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +86 -77
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +87 -78
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +87 -78
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +7 -3
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +11 -7
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +66 -35
- package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +8 -0
- package/dist/types/excalidraw/clipboard.d.ts +58 -21
- package/dist/types/excalidraw/components/Actions.d.ts +33 -11
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +415 -154
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
- package/dist/types/excalidraw/components/App.text.d.ts +146 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +123 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +6 -5
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +2 -3
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
- 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 +4 -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 +9 -3
- 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 +12 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +19 -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 +8 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +108 -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 +26 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +9 -4
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +16 -5
- package/dist/types/excalidraw/components/icons.d.ts +56 -22
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +373 -15
- 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 +11 -12
- package/dist/types/excalidraw/data/json.d.ts +192 -3
- package/dist/types/excalidraw/data/library.d.ts +25 -10
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +25 -10
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
- package/dist/types/excalidraw/history.d.ts +10 -4
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +23 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +492 -20
- package/dist/types/excalidraw/scene/export.d.ts +344 -21
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +51 -9
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +12 -12
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +697 -61
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +19 -5
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +8 -2
- package/dist/types/math/src/polygon.d.ts +26 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +10 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/index.d.ts +4 -3
- package/dist/types/utils/src/shape.d.ts +8 -8
- package/package.json +7 -1
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -185
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
- package/dist/types/excalidraw/components/shapes.d.ts +0 -190
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/export.d.ts +0 -35
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -1,31 +1,299 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MIME_TYPES } from "@excalidraw/common";
|
|
2
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
3
|
+
import type { ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement, Theme } from "@excalidraw/element/types";
|
|
4
|
+
import { cleanAppStateForExport } from "../appState";
|
|
2
5
|
import type { AppState, BinaryFiles } from "../types";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export type ExportSceneData = {
|
|
7
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
8
|
+
/**
|
|
9
|
+
* The scene settings a `.excalidraw` file stores (`viewBackgroundColor`,
|
|
10
|
+
* grid settings) — not editor state. Used as the default background
|
|
11
|
+
* (`canvasBackgroundColor`) and embedded with the scene (`embedScene`).
|
|
12
|
+
* Anything else passed in is ignored; rendering options go to `config`.
|
|
13
|
+
*/
|
|
14
|
+
appState?: ReturnType<typeof cleanAppStateForExport>;
|
|
15
|
+
files?: BinaryFiles | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The host capabilities an export uses, shared by every format: e.g. for test
|
|
19
|
+
* environments, Node.js or another window.
|
|
20
|
+
*
|
|
21
|
+
* Unlike the editor's `renderEnvironment` prop, this needn't be the same
|
|
22
|
+
* object across exports (e.g. on a server): exports draw without the element
|
|
23
|
+
* caches keyed by an environment, and measure little text. Passing a complete
|
|
24
|
+
* one (`createCanvas` and `createImage`) as-is, as the editor does, only keeps
|
|
25
|
+
* its measuring caches warm.
|
|
26
|
+
*/
|
|
27
|
+
type ExportEnvironment = {
|
|
28
|
+
/**
|
|
29
|
+
* Creates the canvas a canvas/PNG/JPEG export renders into, and any canvas
|
|
30
|
+
* the export measures text with (e.g. frame labels, embed placeholders).
|
|
31
|
+
*
|
|
32
|
+
* Do not set `canvas.width/height` or modify the canvas context as that's
|
|
33
|
+
* handled by Excalidraw.
|
|
34
|
+
*
|
|
35
|
+
* Defaults to `document.createElement("canvas")`.
|
|
36
|
+
*/
|
|
37
|
+
createCanvas?: RenderEnvironment["createCanvas"];
|
|
38
|
+
/**
|
|
39
|
+
* Creates the images that image elements are decoded into.
|
|
40
|
+
*
|
|
41
|
+
* Defaults to `new Image()`.
|
|
42
|
+
*/
|
|
43
|
+
createImage?: RenderEnvironment["createImage"];
|
|
44
|
+
/**
|
|
45
|
+
* Creates the paths that freedraw elements are filled through.
|
|
46
|
+
*
|
|
47
|
+
* Defaults to the global `Path2D`.
|
|
48
|
+
*/
|
|
49
|
+
createPath?: RenderEnvironment["createPath"];
|
|
50
|
+
/**
|
|
51
|
+
* The document an SVG export is built in, e.g. a popout window's or,
|
|
52
|
+
* outside the browser, a DOM implementation's (such as `linkedom`).
|
|
53
|
+
*
|
|
54
|
+
* Defaults to the global `document`.
|
|
55
|
+
*/
|
|
56
|
+
document?: RenderEnvironment["document"];
|
|
57
|
+
/**
|
|
58
|
+
* Measures text (frame labels, embed placeholders), e.g. where there is no
|
|
59
|
+
* canvas to measure on.
|
|
60
|
+
*
|
|
61
|
+
* Defaults to the global provider set with `setCustomTextMetricsProvider`,
|
|
62
|
+
* else to measuring on a canvas from `createCanvas`.
|
|
63
|
+
*/
|
|
64
|
+
textMetrics?: RenderEnvironment["textMetrics"];
|
|
65
|
+
/**
|
|
66
|
+
* Loads the fonts the exported elements use, before rendering.
|
|
67
|
+
*
|
|
68
|
+
* Defaults to loading them through the browser's
|
|
69
|
+
* [FontFace API](https://developer.mozilla.org/en-US/docs/Web/API/FontFace).
|
|
70
|
+
*/
|
|
71
|
+
loadFonts?: () => Promise<void>;
|
|
72
|
+
};
|
|
73
|
+
type ExportSceneBaseConfig = {
|
|
74
|
+
/**
|
|
75
|
+
* @default "light"
|
|
76
|
+
*/
|
|
77
|
+
theme?: Theme;
|
|
78
|
+
/**
|
|
79
|
+
* Canvas background. Valid values are:
|
|
80
|
+
*
|
|
81
|
+
* - `undefined` - the background of "appState.viewBackgroundColor" is used.
|
|
82
|
+
* - `false` - no background is used (transparent). Not supported for JPEG,
|
|
83
|
+
* which falls back to the default.
|
|
84
|
+
* - `string` - should be a valid CSS color.
|
|
85
|
+
*
|
|
86
|
+
* Specified in light-theme terms: `theme: "dark"` transforms it like any
|
|
87
|
+
* other scene color. Only affects the rendered image, not the embedded
|
|
88
|
+
* scene (`embedScene`).
|
|
89
|
+
*
|
|
90
|
+
* @default undefined
|
|
91
|
+
*/
|
|
92
|
+
canvasBackgroundColor?: string | false;
|
|
93
|
+
/**
|
|
94
|
+
* Canvas padding in pixels. Affected by `scale`.
|
|
95
|
+
*
|
|
96
|
+
* When `fit` is `none`, padding is added around the content bounding box,
|
|
97
|
+
* or around the `width`/`height` frame if set — in which case the content
|
|
98
|
+
* may overflow the frame, thus right or bottom padding may be ignored.
|
|
99
|
+
*
|
|
100
|
+
* When `fit` is `contain`, or `maxWidthOrHeight`/`widthOrHeight` is set,
|
|
101
|
+
* padding is subtracted from the target size (so the export doesn't exceed
|
|
102
|
+
* it, `scale` aside), and serves as a minimum distance between the content
|
|
103
|
+
* and the canvas edges — it may be exceeded on one axis to maintain the
|
|
104
|
+
* aspect ratio. It is recommended to set `position` to `center` when using
|
|
105
|
+
* `fit: "contain"`.
|
|
106
|
+
*
|
|
107
|
+
* @default 10
|
|
108
|
+
*/
|
|
109
|
+
padding?: number;
|
|
110
|
+
/**
|
|
111
|
+
* A multiplier to increase/decrease the frame dimensions
|
|
112
|
+
* (content resolution).
|
|
113
|
+
*
|
|
114
|
+
* For example, if your canvas is 300x150 and you set scale to 2, the
|
|
115
|
+
* resulting size will be 600x300.
|
|
116
|
+
*
|
|
117
|
+
* Can be a function, which receives the export dimensions at scale 1
|
|
118
|
+
* (padding included) and returns the multiplier — e.g. to cap the output
|
|
119
|
+
* by a pixel budget.
|
|
120
|
+
*
|
|
121
|
+
* @default 1
|
|
122
|
+
*/
|
|
123
|
+
scale?: number | ((width: number, height: number) => number);
|
|
124
|
+
/**
|
|
125
|
+
* Host environment overrides, e.g. for test environments or Node.js.
|
|
126
|
+
*/
|
|
127
|
+
environment?: ExportEnvironment;
|
|
128
|
+
exportingFrame?: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
129
|
+
/**
|
|
130
|
+
* Which frame decorations to render. Ignored when exporting a single frame
|
|
131
|
+
* (`exportingFrame`), which renders neither its name nor outline, and clips
|
|
132
|
+
* to it.
|
|
133
|
+
*
|
|
134
|
+
* @default { name: true, outline: true, clip: true }
|
|
135
|
+
*/
|
|
136
|
+
frames?: {
|
|
137
|
+
name?: boolean;
|
|
138
|
+
outline?: boolean;
|
|
139
|
+
clip?: boolean;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* The ways to size the export — only one can be used. The positioning options
|
|
144
|
+
* (`fit`, `position`, `x`, `y`, `origin`) belong to `width`/`height` (or no
|
|
145
|
+
* size option).
|
|
146
|
+
*/
|
|
147
|
+
type ExportSizeOptions = {
|
|
148
|
+
/**
|
|
149
|
+
* Makes sure the canvas content fits into a frame of width/height no larger
|
|
150
|
+
* than this value, while maintaining the aspect ratio.
|
|
151
|
+
*
|
|
152
|
+
* Final dimensions can get smaller/larger if used in conjunction with
|
|
153
|
+
* `scale`.
|
|
154
|
+
*
|
|
155
|
+
* Can't be combined with `width`/`height`, `widthOrHeight`, or the
|
|
156
|
+
* positioning options (`fit`, `position`, `x`, `y`, `origin`).
|
|
157
|
+
*/
|
|
158
|
+
maxWidthOrHeight?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Scale the canvas content to be exactly this many pixels wide/tall,
|
|
161
|
+
* maintaining the aspect ratio.
|
|
162
|
+
*
|
|
163
|
+
* Final dimensions can get smaller/larger if used in conjunction with
|
|
164
|
+
* `scale`.
|
|
165
|
+
*
|
|
166
|
+
* Can't be combined with `width`/`height`, `maxWidthOrHeight`, or the
|
|
167
|
+
* positioning options (`fit`, `position`, `x`, `y`, `origin`).
|
|
168
|
+
*/
|
|
169
|
+
widthOrHeight?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Width of the frame. Supply `x` or `y` if you want to offset the canvas
|
|
172
|
+
* content.
|
|
173
|
+
*
|
|
174
|
+
* If `width` omitted but `height` supplied, `width` is calculated from the
|
|
175
|
+
* content's aspect ratio when `fit` is `contain` (the default), or is the
|
|
176
|
+
* content bounding box width when `fit` is `none`.
|
|
177
|
+
*
|
|
178
|
+
* Defaults to the content bounding box width when both `width` and `height`
|
|
179
|
+
* are omitted.
|
|
180
|
+
*
|
|
181
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`.
|
|
182
|
+
*/
|
|
183
|
+
width?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Height of the frame.
|
|
186
|
+
*
|
|
187
|
+
* If `height` omitted but `width` supplied, `height` is calculated from the
|
|
188
|
+
* content's aspect ratio when `fit` is `contain` (the default), or is the
|
|
189
|
+
* content bounding box height when `fit` is `none`.
|
|
190
|
+
*
|
|
191
|
+
* Defaults to the content bounding box height when both `width` and `height`
|
|
192
|
+
* are omitted.
|
|
193
|
+
*
|
|
194
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`.
|
|
195
|
+
*/
|
|
196
|
+
height?: number;
|
|
197
|
+
/**
|
|
198
|
+
* Left edge of the exported region (`padding` is added around it). By
|
|
199
|
+
* default the coordinate is relative to the canvas. You can switch to
|
|
200
|
+
* content coordinates by setting `origin` to `content`.
|
|
201
|
+
*
|
|
202
|
+
* Defaults to the `x` position of the content bounding box.
|
|
203
|
+
*
|
|
204
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`, and is
|
|
205
|
+
* ignored with `fit: "contain"`, so setting `x` or `y` makes `fit` default
|
|
206
|
+
* to `none` (cropping the region).
|
|
207
|
+
*/
|
|
208
|
+
x?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Top edge of the exported region (`padding` is added around it). By
|
|
211
|
+
* default the coordinate is relative to the canvas. You can switch to
|
|
212
|
+
* content coordinates by setting `origin` to `content`.
|
|
213
|
+
*
|
|
214
|
+
* Defaults to the `y` position of the content bounding box.
|
|
215
|
+
*
|
|
216
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`, and is
|
|
217
|
+
* ignored with `fit: "contain"`, so setting `x` or `y` makes `fit` default
|
|
218
|
+
* to `none` (cropping the region).
|
|
219
|
+
*/
|
|
220
|
+
y?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Indicates the coordinate system of the `x` and `y` values.
|
|
223
|
+
*
|
|
224
|
+
* - `canvas` - `x` and `y` are relative to the canvas [0, 0] position.
|
|
225
|
+
* - `content` - `x` and `y` are relative to the content bounding box.
|
|
226
|
+
*
|
|
227
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`.
|
|
228
|
+
*
|
|
229
|
+
* @default "canvas"
|
|
230
|
+
*/
|
|
231
|
+
origin?: "canvas" | "content";
|
|
232
|
+
/**
|
|
233
|
+
* How the content should be scaled into the `width`/`height` frame.
|
|
234
|
+
*
|
|
235
|
+
* Behavior aligns with the `object-fit` CSS property.
|
|
236
|
+
*
|
|
237
|
+
* - `none` - no scaling.
|
|
238
|
+
* - `contain` - scale to fit the frame. Includes `padding`.
|
|
239
|
+
*
|
|
240
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`.
|
|
241
|
+
*
|
|
242
|
+
* @default "contain" if `width` or `height` is set (and `x`/`y` aren't),
|
|
243
|
+
* otherwise "none"
|
|
244
|
+
*/
|
|
245
|
+
fit?: "none" | "contain";
|
|
246
|
+
/**
|
|
247
|
+
* When either `x` or `y` are not specified, indicates how the canvas should
|
|
248
|
+
* be aligned on the respective axis.
|
|
249
|
+
*
|
|
250
|
+
* - `topLeft` - canvas aligned to top left.
|
|
251
|
+
* - `center` - canvas is centered on the axis which is not specified
|
|
252
|
+
* (or both).
|
|
253
|
+
*
|
|
254
|
+
* Can't be combined with `maxWidthOrHeight` or `widthOrHeight`.
|
|
255
|
+
*
|
|
256
|
+
* @default "center"
|
|
257
|
+
*/
|
|
258
|
+
position?: "center" | "topLeft";
|
|
259
|
+
};
|
|
260
|
+
type ExportSizeOption<K extends keyof ExportSizeOptions> = Pick<ExportSizeOptions, K> & {
|
|
261
|
+
[P in keyof ExportSizeOptions as P extends K ? never : P]?: never;
|
|
262
|
+
};
|
|
263
|
+
type ExportSizeConfig = ExportSizeOption<"width" | "height" | "fit" | "position" | "x" | "y" | "origin"> | ExportSizeOption<"maxWidthOrHeight"> | ExportSizeOption<"widthOrHeight">;
|
|
264
|
+
export type ExportSceneConfig = ExportSceneBaseConfig & ExportSizeConfig;
|
|
265
|
+
/**
|
|
266
|
+
* The export config the editor's export settings translate to. Internal: hosts
|
|
267
|
+
* pass their own config.
|
|
268
|
+
*/
|
|
269
|
+
export declare const getExportConfigFromAppState: (appState: Pick<AppState, "exportWithDarkMode" | "exportBackground" | "viewBackgroundColor" | "exportScale" | "frameRendering">) => {
|
|
270
|
+
theme: "light" | "dark";
|
|
271
|
+
canvasBackgroundColor: string | false;
|
|
10
272
|
scale: number;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
273
|
+
frames: {
|
|
274
|
+
enabled: boolean;
|
|
275
|
+
name: boolean;
|
|
276
|
+
outline: boolean;
|
|
277
|
+
clip: boolean;
|
|
278
|
+
} | {
|
|
279
|
+
name: boolean;
|
|
280
|
+
outline: boolean;
|
|
281
|
+
clip: boolean;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
type ExportToSvgConfig = Pick<ExportSceneBaseConfig, "canvasBackgroundColor" | "padding" | "theme" | "exportingFrame" | "scale" | "frames" | "environment"> & ExportSizeConfig & {
|
|
21
285
|
/**
|
|
22
286
|
* if true, all embeddables passed in will be rendered when possible.
|
|
23
287
|
*/
|
|
24
288
|
renderEmbeddables?: boolean;
|
|
25
|
-
exportingFrame?: ExcalidrawFrameLikeElement | null;
|
|
26
289
|
skipInliningFonts?: true;
|
|
27
290
|
reuseImages?: boolean;
|
|
28
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Embeds the scene into the SVG, so that it can be imported back into
|
|
293
|
+
* Excalidraw.
|
|
294
|
+
*/
|
|
295
|
+
embedScene?: boolean;
|
|
296
|
+
};
|
|
29
297
|
export declare const encodeSvgBase64Payload: ({ payload, metadataElement, }: {
|
|
30
298
|
payload: string;
|
|
31
299
|
metadataElement: SVGMetadataElement;
|
|
@@ -33,4 +301,59 @@ export declare const encodeSvgBase64Payload: ({ payload, metadataElement, }: {
|
|
|
33
301
|
export declare const decodeSvgBase64Payload: ({ svg }: {
|
|
34
302
|
svg: string;
|
|
35
303
|
}) => string;
|
|
36
|
-
export
|
|
304
|
+
export { MIME_TYPES };
|
|
305
|
+
type ExportToPngConfig = ExportSceneConfig & {
|
|
306
|
+
/**
|
|
307
|
+
* Embeds the scene into the PNG metadata, so that it can be imported back
|
|
308
|
+
* into Excalidraw.
|
|
309
|
+
*/
|
|
310
|
+
embedScene?: boolean;
|
|
311
|
+
};
|
|
312
|
+
type ExportToJpegConfig = ExportSceneConfig & {
|
|
313
|
+
/**
|
|
314
|
+
* Encoding quality between 0 and 1.
|
|
315
|
+
*
|
|
316
|
+
* @default 0.92
|
|
317
|
+
*/
|
|
318
|
+
quality?: number;
|
|
319
|
+
};
|
|
320
|
+
export type ExportSceneOptions = {
|
|
321
|
+
data: ExportSceneData;
|
|
322
|
+
} & ({
|
|
323
|
+
type: "canvas";
|
|
324
|
+
config?: ExportSceneConfig;
|
|
325
|
+
} | {
|
|
326
|
+
type: "png";
|
|
327
|
+
config?: ExportToPngConfig;
|
|
328
|
+
} | {
|
|
329
|
+
type: "jpeg";
|
|
330
|
+
config?: ExportToJpegConfig;
|
|
331
|
+
} | {
|
|
332
|
+
type: "svg";
|
|
333
|
+
config?: ExportToSvgConfig;
|
|
334
|
+
});
|
|
335
|
+
/**
|
|
336
|
+
* Exports the scene to a canvas, a PNG or JPEG blob, or an SVG element.
|
|
337
|
+
*/
|
|
338
|
+
export declare function exportScene(opts: Extract<ExportSceneOptions, {
|
|
339
|
+
type: "canvas";
|
|
340
|
+
}>): Promise<HTMLCanvasElement>;
|
|
341
|
+
export declare function exportScene(opts: Extract<ExportSceneOptions, {
|
|
342
|
+
type: "png" | "jpeg";
|
|
343
|
+
}>): Promise<Blob>;
|
|
344
|
+
export declare function exportScene(opts: Extract<ExportSceneOptions, {
|
|
345
|
+
type: "svg";
|
|
346
|
+
}>): Promise<SVGSVGElement>;
|
|
347
|
+
export declare function exportScene(opts: ExportSceneOptions): Promise<HTMLCanvasElement | Blob | SVGSVGElement>;
|
|
348
|
+
export declare const exportToClipboard: (opts: {
|
|
349
|
+
data: ExportSceneData;
|
|
350
|
+
} & ({
|
|
351
|
+
type: "png";
|
|
352
|
+
config?: ExportToPngConfig;
|
|
353
|
+
} | {
|
|
354
|
+
type: "svg";
|
|
355
|
+
config?: ExportToSvgConfig;
|
|
356
|
+
} | {
|
|
357
|
+
type: "json";
|
|
358
|
+
config?: never;
|
|
359
|
+
})) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
|
|
2
|
-
export {
|
|
3
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
|
|
2
|
+
export { getScrollToContentState } from "../viewport";
|
|
3
|
+
export { hasBackground, hasFillStyle, hasRoughness, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
|
|
4
4
|
export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
|
|
@@ -1,22 +1,49 @@
|
|
|
1
|
-
import type { UserIdleState } from "@excalidraw/common";
|
|
2
|
-
import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
1
|
+
import type { UserIdleState, EditorInterface } from "@excalidraw/common";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
3
3
|
import type { MakeBrand } from "@excalidraw/common/utility-types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { RenderEnvironment } from "@excalidraw/element/renderEnvironment";
|
|
5
|
+
import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementRenderOverrides, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
|
|
5
6
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
6
7
|
import type { Drawable } from "roughjs/bin/core";
|
|
7
8
|
export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
|
|
8
9
|
export type StaticCanvasRenderConfig = {
|
|
9
10
|
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
11
|
+
/**
|
|
12
|
+
* Backing-store scale the target canvas was bootstrapped with -- the owner
|
|
13
|
+
* window's devicePixelRatio when rendering into the editor, exportScale when
|
|
14
|
+
* exporting. Element caches are built and blitted at this ratio, so it must
|
|
15
|
+
* be the same value passed as `StaticSceneRenderConfig["scale"]`.
|
|
16
|
+
*/
|
|
17
|
+
scale: number;
|
|
18
|
+
/**
|
|
19
|
+
* Host environment that creates the canvases and images this render
|
|
20
|
+
* rasterizes (per-editor owner window in the app; the export's
|
|
21
|
+
* `config.environment` when exporting). Defaults to the browser's.
|
|
22
|
+
*/
|
|
23
|
+
renderEnvironment?: RenderEnvironment;
|
|
24
|
+
/** export only: clips everything drawn to this frame (square corners) */
|
|
25
|
+
clipToFrame?: ExcalidrawFrameLikeElement | null;
|
|
10
26
|
imageCache: AppClassProperties["imageCache"];
|
|
11
27
|
renderGrid: boolean;
|
|
28
|
+
/** whether to render link icons on elements with links (never rendered
|
|
29
|
+
when exporting). @default true */
|
|
30
|
+
renderLinks?: boolean;
|
|
12
31
|
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
13
32
|
CSS filters), and we disable render optimizations for best output */
|
|
14
33
|
isExporting: boolean;
|
|
15
34
|
embedsValidationStatus: EmbedsValidationStatus;
|
|
16
35
|
elementsPendingErasure: ElementsPendingErasure;
|
|
17
36
|
pendingFlowchartNodes: PendingExcalidrawElements | null;
|
|
37
|
+
theme: AppState["theme"];
|
|
38
|
+
elementRenderOverrides?: ElementRenderOverrides;
|
|
18
39
|
};
|
|
19
40
|
export type SVGRenderConfig = {
|
|
41
|
+
/**
|
|
42
|
+
* Host environment used for the text measurements this render needs (the
|
|
43
|
+
* SVG itself is built through `exportToSvg`'s owner document). Defaults to
|
|
44
|
+
* the browser's.
|
|
45
|
+
*/
|
|
46
|
+
renderEnvironment?: RenderEnvironment;
|
|
20
47
|
offsetX: number;
|
|
21
48
|
offsetY: number;
|
|
22
49
|
isExporting: boolean;
|
|
@@ -32,6 +59,7 @@ export type SVGRenderConfig = {
|
|
|
32
59
|
* @default true
|
|
33
60
|
*/
|
|
34
61
|
reuseImages: boolean;
|
|
62
|
+
theme: AppState["theme"];
|
|
35
63
|
};
|
|
36
64
|
export type InteractiveCanvasRenderConfig = {
|
|
37
65
|
remoteSelectedElementIds: Map<ExcalidrawElement["id"], SocketId[]>;
|
|
@@ -43,11 +71,13 @@ export type InteractiveCanvasRenderConfig = {
|
|
|
43
71
|
remotePointerUsernames: Map<SocketId, string>;
|
|
44
72
|
remotePointerButton: Map<SocketId, string | undefined>;
|
|
45
73
|
selectionColor: string;
|
|
74
|
+
lastViewportPosition: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
};
|
|
46
78
|
renderScrollbars?: boolean;
|
|
47
79
|
};
|
|
48
80
|
export type RenderInteractiveSceneCallback = {
|
|
49
|
-
atLeastOneVisibleElement: boolean;
|
|
50
|
-
elementsMap: RenderableElementsMap;
|
|
51
81
|
scrollBars?: ScrollBars;
|
|
52
82
|
};
|
|
53
83
|
export type StaticSceneRenderConfig = {
|
|
@@ -60,7 +90,13 @@ export type StaticSceneRenderConfig = {
|
|
|
60
90
|
appState: StaticCanvasAppState;
|
|
61
91
|
renderConfig: StaticCanvasRenderConfig;
|
|
62
92
|
};
|
|
93
|
+
export type InteractiveSceneRenderAnimationState = {
|
|
94
|
+
bindingHighlight: {
|
|
95
|
+
runtime: number;
|
|
96
|
+
} | undefined;
|
|
97
|
+
};
|
|
63
98
|
export type InteractiveSceneRenderConfig = {
|
|
99
|
+
app: AppClassProperties;
|
|
64
100
|
canvas: HTMLCanvasElement | null;
|
|
65
101
|
elementsMap: RenderableElementsMap;
|
|
66
102
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
@@ -69,13 +105,15 @@ export type InteractiveSceneRenderConfig = {
|
|
|
69
105
|
scale: number;
|
|
70
106
|
appState: InteractiveCanvasAppState;
|
|
71
107
|
renderConfig: InteractiveCanvasRenderConfig;
|
|
72
|
-
|
|
108
|
+
editorInterface: EditorInterface;
|
|
73
109
|
callback: (data: RenderInteractiveSceneCallback) => void;
|
|
110
|
+
animationState?: InteractiveSceneRenderAnimationState;
|
|
111
|
+
deltaTime: number;
|
|
74
112
|
};
|
|
75
113
|
export type NewElementSceneRenderConfig = {
|
|
76
114
|
canvas: HTMLCanvasElement | null;
|
|
77
115
|
rc: RoughCanvas;
|
|
78
|
-
newElement:
|
|
116
|
+
newElement: NonDeletedExcalidrawElement | null;
|
|
79
117
|
elementsMap: RenderableElementsMap;
|
|
80
118
|
allElementsMap: NonDeletedSceneElementsMap;
|
|
81
119
|
scale: number;
|
|
@@ -103,17 +141,21 @@ export type ScrollBars = {
|
|
|
103
141
|
deltaMultiplier: number;
|
|
104
142
|
} | null;
|
|
105
143
|
};
|
|
106
|
-
export type
|
|
144
|
+
export type SVGPathString = string & {
|
|
145
|
+
__brand: "SVGPathString";
|
|
146
|
+
};
|
|
147
|
+
export type ElementShape = Drawable | Drawable[] | Path2D | (Drawable | SVGPathString)[] | null;
|
|
107
148
|
export type ElementShapes = {
|
|
108
149
|
rectangle: Drawable;
|
|
109
150
|
ellipse: Drawable;
|
|
110
151
|
diamond: Drawable;
|
|
111
152
|
iframe: Drawable;
|
|
112
153
|
embeddable: Drawable;
|
|
113
|
-
freedraw: Drawable |
|
|
154
|
+
freedraw: (Drawable | SVGPathString)[];
|
|
114
155
|
arrow: Drawable[];
|
|
115
156
|
line: Drawable[];
|
|
116
157
|
text: null;
|
|
158
|
+
stickynote: null;
|
|
117
159
|
image: null;
|
|
118
160
|
frame: null;
|
|
119
161
|
magicframe: null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getShortcutKey: (shortcut: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { InclusiveRange } from "@excalidraw/math";
|
|
3
|
-
import type { Bounds } from "@excalidraw/
|
|
3
|
+
import type { Bounds } from "@excalidraw/common";
|
|
4
4
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
5
|
import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
6
6
|
import type { AppClassProperties, AppState, KeyboardModifiersObject } from "./types";
|
|
@@ -66,19 +66,19 @@ export declare const isGridModeEnabled: (app: AppClassProperties) => boolean;
|
|
|
66
66
|
export declare const isSnappingEnabled: ({ event, app, selectedElements, }: {
|
|
67
67
|
app: AppClassProperties;
|
|
68
68
|
event: KeyboardModifiersObject;
|
|
69
|
-
selectedElements: NonDeletedExcalidrawElement[];
|
|
69
|
+
selectedElements: readonly NonDeletedExcalidrawElement[];
|
|
70
70
|
}) => boolean;
|
|
71
71
|
export declare const areRoughlyEqual: (a: number, b: number, precision?: number) => boolean;
|
|
72
|
-
export declare const getElementsCorners: (elements:
|
|
73
|
-
omitCenter?: boolean
|
|
74
|
-
boundingBoxCorners?: boolean
|
|
75
|
-
dragOffset?: Vector2D
|
|
72
|
+
export declare const getElementsCorners: (elements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, { omitCenter, boundingBoxCorners, dragOffset, }?: {
|
|
73
|
+
omitCenter?: boolean;
|
|
74
|
+
boundingBoxCorners?: boolean;
|
|
75
|
+
dragOffset?: Vector2D;
|
|
76
76
|
}) => GlobalPoint[];
|
|
77
|
-
export declare const getVisibleGaps: (elements: readonly NonDeletedExcalidrawElement[], selectedElements:
|
|
77
|
+
export declare const getVisibleGaps: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => {
|
|
78
78
|
horizontalGaps: Gap[];
|
|
79
79
|
verticalGaps: Gap[];
|
|
80
80
|
};
|
|
81
|
-
export declare const getReferenceSnapPoints: (elements: readonly NonDeletedExcalidrawElement[], selectedElements:
|
|
81
|
+
export declare const getReferenceSnapPoints: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => GlobalPoint[];
|
|
82
82
|
export declare const snapDraggedElements: (elements: ExcalidrawElement[], dragOffset: Vector2D, app: AppClassProperties, event: KeyboardModifiersObject, elementsMap: ElementsMap) => {
|
|
83
83
|
snapOffset: {
|
|
84
84
|
x: number;
|
|
@@ -86,26 +86,26 @@ export declare const snapDraggedElements: (elements: ExcalidrawElement[], dragOf
|
|
|
86
86
|
};
|
|
87
87
|
snapLines: (PointSnapLine | GapSnapLine)[];
|
|
88
88
|
};
|
|
89
|
-
export declare const snapResizingElements: (selectedElements:
|
|
89
|
+
export declare const snapResizingElements: (selectedElements: readonly NonDeletedExcalidrawElement[], selectedOriginalElements: readonly NonDeletedExcalidrawElement[], app: AppClassProperties, event: KeyboardModifiersObject, dragOffset: Vector2D, transformHandle: MaybeTransformHandleType) => {
|
|
90
90
|
snapOffset: {
|
|
91
91
|
x: number;
|
|
92
92
|
y: number;
|
|
93
93
|
};
|
|
94
94
|
snapLines: PointSnapLine[];
|
|
95
95
|
};
|
|
96
|
-
export declare const snapNewElement: (newElement:
|
|
96
|
+
export declare const snapNewElement: (newElement: NonDeletedExcalidrawElement, app: AppClassProperties, event: KeyboardModifiersObject, origin: Vector2D, dragOffset: Vector2D, elementsMap: ElementsMap) => {
|
|
97
97
|
snapOffset: {
|
|
98
98
|
x: number;
|
|
99
99
|
y: number;
|
|
100
100
|
};
|
|
101
101
|
snapLines: PointSnapLine[];
|
|
102
102
|
};
|
|
103
|
-
export declare const getSnapLinesAtPointer: (elements: readonly
|
|
103
|
+
export declare const getSnapLinesAtPointer: (elements: readonly NonDeletedExcalidrawElement[], app: AppClassProperties, pointer: Vector2D, event: KeyboardModifiersObject, elementsMap: ElementsMap) => {
|
|
104
104
|
originOffset: {
|
|
105
105
|
x: number;
|
|
106
106
|
y: number;
|
|
107
107
|
};
|
|
108
108
|
snapLines: PointerSnapLine[];
|
|
109
109
|
};
|
|
110
|
-
export declare const isActiveToolNonLinearSnappable: (activeToolType: AppState["activeTool"]["type"]) =>
|
|
110
|
+
export declare const isActiveToolNonLinearSnappable: (activeToolType: AppState["activeTool"]["type"]) => activeToolType is "text" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "magicframe";
|
|
111
111
|
export {};
|
|
@@ -38,7 +38,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
38
38
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
39
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
40
|
*/
|
|
41
|
-
declare function subset(hbSubsetWasm: any, heapu8: Uint8Array, font: ArrayBuffer, codePoints: ReadonlySet<number>): Uint8Array
|
|
41
|
+
declare function subset(hbSubsetWasm: any, heapu8: Uint8Array, font: ArrayBuffer, codePoints: ReadonlySet<number>): Uint8Array<ArrayBuffer>;
|
|
42
42
|
declare const _default: {
|
|
43
43
|
subset: typeof subset;
|
|
44
44
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* In the future consider separating common utils into a separate shared chunk.
|
|
8
8
|
*/
|
|
9
9
|
declare const load: () => Promise<{
|
|
10
|
-
subset: (fontBuffer: ArrayBuffer, codePoints: ReadonlySet<number>) => Uint8Array
|
|
10
|
+
subset: (fontBuffer: ArrayBuffer, codePoints: ReadonlySet<number>) => Uint8Array<ArrayBuffer>;
|
|
11
11
|
}>;
|
|
12
12
|
declare const _default: () => ReturnType<typeof load>;
|
|
13
13
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: Uint8Array
|
|
1
|
+
declare const _default: Uint8Array<ArrayBuffer>;
|
|
2
2
|
export default _default;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* In the future consider separating common utils into a separate shared chunk.
|
|
8
8
|
*/
|
|
9
9
|
declare const load: () => Promise<{
|
|
10
|
-
compress: (buffer: ArrayBuffer) => Uint8Array
|
|
11
|
-
decompress: (buffer: ArrayBuffer) => Uint8Array
|
|
10
|
+
compress: (buffer: ArrayBuffer) => Uint8Array<ArrayBuffer>;
|
|
11
|
+
decompress: (buffer: ArrayBuffer) => Uint8Array<ArrayBuffer>;
|
|
12
12
|
}>;
|
|
13
13
|
declare const _default: () => ReturnType<typeof load>;
|
|
14
14
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: Uint8Array
|
|
1
|
+
declare const _default: Uint8Array<ArrayBuffer>;
|
|
2
2
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { EditorInterface } from "@excalidraw/common";
|
|
3
|
+
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
4
|
+
export declare const getTextBoxPadding: (zoomValue: number) => number;
|
|
5
|
+
export declare const getTextAutoResizeHandle: (textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => {
|
|
6
|
+
center: GlobalPoint | import("@excalidraw/math").LocalPoint;
|
|
7
|
+
start: GlobalPoint;
|
|
8
|
+
end: GlobalPoint;
|
|
9
|
+
hitboxWidth: number;
|
|
10
|
+
hitboxHeight: number;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare const isPointHittingTextAutoResizeHandle: (point: Readonly<{
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}>, textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => boolean;
|