@excalidraw/element 0.18.0-508de2f3a → 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 +7356 -4244
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +20 -19
- 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 +46 -33
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +46 -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 +67 -48
- package/dist/types/element/src/bounds.d.ts +25 -18
- package/dist/types/element/src/collision.d.ts +7 -2
- package/dist/types/element/src/comparisons.d.ts +8 -7
- package/dist/types/element/src/delta.d.ts +4 -5
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/dragElements.d.ts +3 -3
- package/dist/types/element/src/duplicate.d.ts +4 -3
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +12 -7
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +5 -3
- package/dist/types/element/src/linearElementEditor.d.ts +23 -22
- package/dist/types/element/src/mutateElement.d.ts +5 -2
- package/dist/types/element/src/newElement.d.ts +7 -6
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -7
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +10 -10
- package/dist/types/element/src/shape.d.ts +9 -8
- package/dist/types/element/src/store.d.ts +5 -0
- package/dist/types/element/src/textElement.d.ts +2 -2
- package/dist/types/element/src/textMeasurements.d.ts +1 -3
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +5 -7
- package/dist/types/element/src/types.d.ts +18 -13
- package/dist/types/element/src/utils.d.ts +9 -4
- package/dist/types/element/src/visualdebug.d.ts +58 -0
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +140 -174
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +100 -123
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +520 -1193
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +102 -866
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +48 -60
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +160 -198
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +40 -58
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +98 -121
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +49 -61
- package/dist/types/excalidraw/actions/actionExport.d.ts +179 -1407
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -394
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +292 -374
- package/dist/types/excalidraw/actions/actionGroup.d.ts +103 -134
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +159 -208
- package/dist/types/excalidraw/actions/actionLink.d.ts +46 -58
- package/dist/types/excalidraw/actions/actionMenu.d.ts +39 -423
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
- package/dist/types/excalidraw/actions/actionProperties.d.ts +166 -2510
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +51 -67
- package/dist/types/excalidraw/actions/actionStyles.d.ts +48 -59
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +48 -60
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +48 -60
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +37 -55
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +48 -60
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +48 -60
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +49 -61
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -3
- package/dist/types/excalidraw/actions/index.d.ts +5 -2
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +24 -15
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +57 -19
- package/dist/types/excalidraw/components/Actions.d.ts +22 -5
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +168 -103
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +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 +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/Popover.d.ts +2 -1
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
- package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/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/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +8 -4
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +51 -21
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +24 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/shapes.d.ts +209 -1
- package/dist/types/excalidraw/data/blob.d.ts +331 -12
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
- package/dist/types/excalidraw/data/index.d.ts +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/data/types.d.ts +4 -1
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +16 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
- 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 +22 -5
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +5 -5
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +290 -40
- 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 +4 -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 +10 -3
- 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 -9
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import type { SceneBounds } from "@excalidraw/element";
|
|
2
|
+
import type { Bounds } from "@excalidraw/common";
|
|
3
|
+
import type { ExcalidrawElement, NonDeleted, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
4
|
+
import type { AppState, NormalizedZoomValue, Offsets, PointerCoords, ScrollConstraints, ViewportOffsets, Zoom } from "./types";
|
|
5
|
+
export declare const SCROLL_TO_CONTENT_ANIMATION_KEY = "animateScrollToContent";
|
|
6
|
+
/** default rubberband overscroll give for scroll locks, in viewport px */
|
|
7
|
+
export declare const DEFAULT_OVERSCROLL = 150;
|
|
8
|
+
export type AnimationOptions = {
|
|
9
|
+
duration?: number;
|
|
10
|
+
};
|
|
11
|
+
export type SetViewportRect = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const isSetViewportRect: (target: unknown) => target is SetViewportRect;
|
|
18
|
+
export type SetViewportOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* what to show in the viewport: an explicit scene-coordinate box/rect,
|
|
21
|
+
* element(s), or an element id / element-link URL.
|
|
22
|
+
*
|
|
23
|
+
* IMPORTANT: if supplying ExcalidrawElement(s), only non-deleted elements
|
|
24
|
+
* that actually exist on the canvas are considered. If you want to navigate
|
|
25
|
+
* to elements that's not on canvas yet, supply their bounds by using
|
|
26
|
+
* `getCommonBounds` (see {@link getCommonBounds}).
|
|
27
|
+
*/
|
|
28
|
+
target: Bounds | SetViewportRect | ExcalidrawElement | readonly ExcalidrawElement[] | string;
|
|
29
|
+
/**
|
|
30
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/object-fit
|
|
31
|
+
*
|
|
32
|
+
* - `scale-down` - zoom out so the target fits the viewport, never zooming past 100%
|
|
33
|
+
* - `contain` - zoom the target so it fills the viewport (may exceed 100%)
|
|
34
|
+
* - `none` - keep the current zoom, only center the target in the viewport
|
|
35
|
+
*/
|
|
36
|
+
fit?: "scale-down" | "contain" | "none";
|
|
37
|
+
lock?: {
|
|
38
|
+
/** constraints panning to the target box */
|
|
39
|
+
scroll?: ScrollConstraints["lockScroll"];
|
|
40
|
+
/** makes the resolved zoom the minimum zoom */
|
|
41
|
+
zoom?: ScrollConstraints["lockZoom"];
|
|
42
|
+
/**
|
|
43
|
+
* Rubberband give past the lock, in viewport px (zoom-independent): how
|
|
44
|
+
* far the user can pan beyond the constraint before snapping back.
|
|
45
|
+
* `true` (default) uses {@link DEFAULT_OVERSCROLL}, `false` disables
|
|
46
|
+
* (rigid lock), a number sets the give explicitly.
|
|
47
|
+
*/
|
|
48
|
+
overscroll?: boolean | number;
|
|
49
|
+
};
|
|
50
|
+
animation?: AnimationOptions | boolean;
|
|
51
|
+
/**
|
|
52
|
+
* CSS-style per-side viewport insets, in viewport pixels
|
|
53
|
+
* (zoom-independent) — static values, editor-UI-derived (`ui`), or a
|
|
54
|
+
* combination. See {@link ViewportOffsets}.
|
|
55
|
+
*/
|
|
56
|
+
offsets?: ViewportOffsets;
|
|
57
|
+
};
|
|
58
|
+
type Viewport = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
|
|
59
|
+
/**
|
|
60
|
+
* Clamps a proposed scroll/zoom against the active lock (`scrollConstraints`).
|
|
61
|
+
* Returns the input scroll/zoom unchanged when there is no lock.
|
|
62
|
+
* `overscroll` (screen px, zoom-independent) is rubberband give past the
|
|
63
|
+
* resting clamp — pass 0 for a hard clamp.
|
|
64
|
+
*/
|
|
65
|
+
export declare const constrainScrollState: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, overscroll?: number) => Viewport;
|
|
66
|
+
export declare const isViewportOverscrolled: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Rubberband snap-back: animates the viewport from its current (possibly
|
|
69
|
+
* overscrolled) position back inside the lock box via the shared
|
|
70
|
+
* AnimationController. No-op when already within the hard bounds (or when there
|
|
71
|
+
* is no lock).
|
|
72
|
+
*/
|
|
73
|
+
export declare const animateToConstraints: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, onFrame: (viewport: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom">) => void, duration?: number) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Scrolls (and, per `fit`, zooms) the viewport so the given target box is in
|
|
76
|
+
* view, optionally animating the transition. `onComplete` runs once the
|
|
77
|
+
* viewport has settled on the target.
|
|
78
|
+
*/
|
|
79
|
+
export declare const setViewportToBounds: (state: AppState, bounds: Bounds, opts: Pick<SetViewportOptions, "fit" | "animation"> & {
|
|
80
|
+
offsets?: Offsets;
|
|
81
|
+
}, onFrame: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom">) => void, onComplete?: () => void) => void;
|
|
82
|
+
export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, minZoom, maxZoom, steppedZoom, }: {
|
|
83
|
+
bounds: SceneBounds;
|
|
84
|
+
canvasOffsets?: Offsets;
|
|
85
|
+
appState: Readonly<AppState>;
|
|
86
|
+
fit?: SetViewportOptions["fit"];
|
|
87
|
+
minZoom?: number;
|
|
88
|
+
maxZoom?: number;
|
|
89
|
+
steppedZoom?: boolean;
|
|
90
|
+
}) => {
|
|
91
|
+
appState: {
|
|
92
|
+
scrollX: number;
|
|
93
|
+
scrollY: number;
|
|
94
|
+
zoom: {
|
|
95
|
+
value: NormalizedZoomValue;
|
|
96
|
+
};
|
|
97
|
+
contextMenu: {
|
|
98
|
+
items: import("./components/ContextMenu").ContextMenuItems;
|
|
99
|
+
top: number;
|
|
100
|
+
left: number;
|
|
101
|
+
} | null;
|
|
102
|
+
showWelcomeScreen: boolean;
|
|
103
|
+
isLoading: boolean;
|
|
104
|
+
errorMessage: React.ReactNode;
|
|
105
|
+
activeEmbeddable: {
|
|
106
|
+
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
107
|
+
state: "hover" | "active";
|
|
108
|
+
} | null;
|
|
109
|
+
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
110
|
+
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
111
|
+
multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
112
|
+
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
113
|
+
isBindingEnabled: boolean;
|
|
114
|
+
boxSelectionMode: import("./types").BoxSelectionMode;
|
|
115
|
+
bindingPreference: "enabled" | "disabled";
|
|
116
|
+
isMidpointSnappingEnabled: boolean;
|
|
117
|
+
suggestedBinding: {
|
|
118
|
+
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
119
|
+
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
120
|
+
} | null;
|
|
121
|
+
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
122
|
+
frameRendering: {
|
|
123
|
+
enabled: boolean;
|
|
124
|
+
name: boolean;
|
|
125
|
+
outline: boolean;
|
|
126
|
+
clip: boolean;
|
|
127
|
+
};
|
|
128
|
+
editingFrame: string | null;
|
|
129
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
130
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
131
|
+
activeTool: {
|
|
132
|
+
lastActiveTool: import("./types").ActiveTool | null;
|
|
133
|
+
locked: boolean;
|
|
134
|
+
fromSelection: boolean;
|
|
135
|
+
} & import("./types").ActiveTool;
|
|
136
|
+
preferredSelectionTool: {
|
|
137
|
+
type: "selection" | "lasso";
|
|
138
|
+
initialized: boolean;
|
|
139
|
+
};
|
|
140
|
+
penMode: boolean;
|
|
141
|
+
penDetected: boolean;
|
|
142
|
+
exportBackground: boolean;
|
|
143
|
+
exportEmbedScene: boolean;
|
|
144
|
+
exportWithDarkMode: boolean;
|
|
145
|
+
exportScale: number;
|
|
146
|
+
currentItemStrokeColor: string;
|
|
147
|
+
currentItemBackgroundColor: string;
|
|
148
|
+
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
149
|
+
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
150
|
+
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
151
|
+
currentItemRoughness: number;
|
|
152
|
+
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
153
|
+
currentItemOpacity: number;
|
|
154
|
+
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
155
|
+
currentItemFontSize: number;
|
|
156
|
+
currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
|
|
157
|
+
currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
158
|
+
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
159
|
+
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
160
|
+
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
161
|
+
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
162
|
+
viewBackgroundColor: string;
|
|
163
|
+
scrollConstraints: ScrollConstraints | null;
|
|
164
|
+
cursorButton: "up" | "down";
|
|
165
|
+
scrolledOutside: boolean;
|
|
166
|
+
name: string | null;
|
|
167
|
+
isResizing: boolean;
|
|
168
|
+
isRotating: boolean;
|
|
169
|
+
openMenu: "canvas" | null;
|
|
170
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
171
|
+
openSidebar: {
|
|
172
|
+
name: import("./types").SidebarName;
|
|
173
|
+
tab?: import("./types").SidebarTabName;
|
|
174
|
+
} | null;
|
|
175
|
+
openDialog: null | {
|
|
176
|
+
name: "imageExport" | "help" | "jsonExport";
|
|
177
|
+
} | {
|
|
178
|
+
name: "ttd";
|
|
179
|
+
tab: "text-to-diagram" | "mermaid";
|
|
180
|
+
} | {
|
|
181
|
+
name: "commandPalette";
|
|
182
|
+
} | {
|
|
183
|
+
name: "settings";
|
|
184
|
+
} | {
|
|
185
|
+
name: "elementLinkSelector";
|
|
186
|
+
sourceElementId: ExcalidrawElement["id"];
|
|
187
|
+
} | {
|
|
188
|
+
name: "charts";
|
|
189
|
+
data: import("./charts").Spreadsheet;
|
|
190
|
+
rawText: string;
|
|
191
|
+
};
|
|
192
|
+
defaultSidebarDockedPreference: boolean;
|
|
193
|
+
lastPointerDownWith: import("@excalidraw/element/types").PointerType;
|
|
194
|
+
selectedElementIds: Readonly<{
|
|
195
|
+
[id: string]: true;
|
|
196
|
+
}>;
|
|
197
|
+
hoveredElementIds: Readonly<{
|
|
198
|
+
[id: string]: true;
|
|
199
|
+
}>;
|
|
200
|
+
previousSelectedElementIds: {
|
|
201
|
+
[id: string]: true;
|
|
202
|
+
};
|
|
203
|
+
selectedElementsAreBeingDragged: boolean;
|
|
204
|
+
shouldCacheIgnoreZoom: boolean;
|
|
205
|
+
toast: {
|
|
206
|
+
message: React.ReactNode;
|
|
207
|
+
closable?: boolean;
|
|
208
|
+
duration?: number;
|
|
209
|
+
} | null;
|
|
210
|
+
zenModeEnabled: boolean;
|
|
211
|
+
theme: import("@excalidraw/element/types").Theme;
|
|
212
|
+
gridSize: number;
|
|
213
|
+
gridStep: number;
|
|
214
|
+
gridModeEnabled: boolean;
|
|
215
|
+
viewModeEnabled: boolean;
|
|
216
|
+
selectedGroupIds: {
|
|
217
|
+
[groupId: string]: boolean;
|
|
218
|
+
};
|
|
219
|
+
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
220
|
+
width: number;
|
|
221
|
+
height: number;
|
|
222
|
+
offsetTop: number;
|
|
223
|
+
offsetLeft: number;
|
|
224
|
+
fileHandle: FileSystemFileHandle | null;
|
|
225
|
+
collaborators: Map<import("./types").SocketId, import("./types").Collaborator>;
|
|
226
|
+
stats: {
|
|
227
|
+
open: boolean;
|
|
228
|
+
panels: number;
|
|
229
|
+
};
|
|
230
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
231
|
+
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
232
|
+
snapLines: readonly import("./snapping").SnapLine[];
|
|
233
|
+
originSnapOffset: {
|
|
234
|
+
x: number;
|
|
235
|
+
y: number;
|
|
236
|
+
} | null;
|
|
237
|
+
objectsSnapModeEnabled: boolean;
|
|
238
|
+
userToFollow: import("./types").UserToFollow | null;
|
|
239
|
+
followedBy: Set<import("./types").SocketId>;
|
|
240
|
+
isCropping: boolean;
|
|
241
|
+
croppingElementId: ExcalidrawElement["id"] | null;
|
|
242
|
+
searchMatches: Readonly<{
|
|
243
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
244
|
+
matches: readonly import("./types").SearchMatch[];
|
|
245
|
+
}> | null;
|
|
246
|
+
activeLockedId: string | null;
|
|
247
|
+
lockedMultiSelections: {
|
|
248
|
+
[groupId: string]: true;
|
|
249
|
+
};
|
|
250
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
251
|
+
};
|
|
252
|
+
captureUpdate: "EVENTUALLY";
|
|
253
|
+
};
|
|
254
|
+
/** Computes the viewport (scroll + zoom) that brings the target box into view,
|
|
255
|
+
* based on the requested fit behavior. */
|
|
256
|
+
export declare const getTargetViewport: (state: AppState, bounds: Bounds, fit?: SetViewportOptions["fit"], offsets?: Offsets) => Viewport;
|
|
257
|
+
export type ResolvedViewportTarget = {
|
|
258
|
+
/** null when the target couldn't be resolved (unknown id/link, or all
|
|
259
|
+
* supplied elements deleted) */
|
|
260
|
+
bounds: Bounds | null;
|
|
261
|
+
/** how the target was specified, so callers can react to unresolved
|
|
262
|
+
* targets themselves (e.g. toast on a broken element link) */
|
|
263
|
+
type: "element" | "area" | "link";
|
|
264
|
+
};
|
|
265
|
+
/** Resolves a `setViewport` target to a scene-coordinate box. */
|
|
266
|
+
export declare const resolveViewportTarget: (target: SetViewportOptions["target"], elementsMap: NonDeletedSceneElementsMap, appState: Pick<AppState, "width" | "height">) => ResolvedViewportTarget;
|
|
267
|
+
/** Computes the viewport patch for landing on `bounds`: the target
|
|
268
|
+
* scroll/zoom, plus the scroll lock to install — or `scrollConstraints: null`
|
|
269
|
+
* to clear a previous lock when none is requested. */
|
|
270
|
+
export declare const getConstrainedTargetViewport: (appState: AppState, bounds: Bounds, { fit, offsets, lock, }: Pick<SetViewportOptions, "fit" | "lock"> & {
|
|
271
|
+
offsets?: Offsets;
|
|
272
|
+
}) => Viewport & {
|
|
273
|
+
scrollConstraints: ScrollConstraints | null;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Interpolates the viewport from `from` to `target` at the (already-eased)
|
|
277
|
+
* blend amount `factor` (0 = `from`, 1 = `target`).
|
|
278
|
+
*
|
|
279
|
+
* Zoom is interpolated geometrically (so it feels uniform), but the pan can't
|
|
280
|
+
* simply lerp alongside it: pairing a geometric zoom with a linear scroll (or
|
|
281
|
+
* a linearly-tweened focal point) makes scene points swoop along curved,
|
|
282
|
+
* non-monotone screen paths once the zoom ratio exceeds ~e (the destination
|
|
283
|
+
* visibly drifts away before converging). Instead we interpolate the view
|
|
284
|
+
* transform affinely — a scene point maps to screen as
|
|
285
|
+
* `(scenePt + scroll) * zoom`, and requiring every point to travel a straight
|
|
286
|
+
* screen line forces `zoom` to be a convex blend `(1-m)*z0 + m*z1` with
|
|
287
|
+
* `scroll * zoom` lerped by that same weight. Deriving `m` from the geometric
|
|
288
|
+
* zoom keeps its pacing while making all screen trajectories straight and
|
|
289
|
+
* monotone.
|
|
290
|
+
*/
|
|
291
|
+
export declare const interpolateViewport: ({ from, target, factor, }: {
|
|
292
|
+
from: Viewport;
|
|
293
|
+
target: Viewport;
|
|
294
|
+
factor: number;
|
|
295
|
+
}) => Viewport;
|
|
296
|
+
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
|
|
297
|
+
x: number;
|
|
298
|
+
y: number;
|
|
299
|
+
}) => Bounds;
|
|
300
|
+
export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, offsets, }: {
|
|
301
|
+
scenePoint: PointerCoords;
|
|
302
|
+
viewportDimensions: {
|
|
303
|
+
height: number;
|
|
304
|
+
width: number;
|
|
305
|
+
};
|
|
306
|
+
zoom: Zoom;
|
|
307
|
+
offsets?: Offsets;
|
|
308
|
+
}) => {
|
|
309
|
+
scrollX: number;
|
|
310
|
+
scrollY: number;
|
|
311
|
+
};
|
|
312
|
+
export declare const getScrollToContentState: (elements: readonly ExcalidrawElement[], appState: AppState) => {
|
|
313
|
+
scrollX: number;
|
|
314
|
+
scrollY: number;
|
|
315
|
+
};
|
|
316
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
3
|
type SubmitHandler = () => void;
|
|
4
|
-
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
|
|
4
|
+
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, initialCaretSceneCoords, }: {
|
|
5
5
|
id: ExcalidrawElement["id"];
|
|
6
6
|
/**
|
|
7
7
|
* textWysiwyg only deals with `originalText`
|
|
@@ -9,7 +9,7 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
9
9
|
* Note: `text`, which can be wrapped and therefore different from `originalText`,
|
|
10
10
|
* is derived from `originalText`
|
|
11
11
|
*/
|
|
12
|
-
onChange?: (
|
|
12
|
+
onChange?: (nextOriginalText: string) => void;
|
|
13
13
|
onSubmit: (data: {
|
|
14
14
|
viaKeyboard: boolean;
|
|
15
15
|
nextOriginalText: string;
|
|
@@ -19,6 +19,10 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
19
19
|
canvas: HTMLCanvasElement;
|
|
20
20
|
excalidrawContainer: HTMLDivElement | null;
|
|
21
21
|
app: App;
|
|
22
|
-
autoSelect?: boolean
|
|
22
|
+
autoSelect?: boolean;
|
|
23
|
+
initialCaretSceneCoords?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | null;
|
|
23
27
|
}) => SubmitHandler;
|
|
24
28
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const BASE_62_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} key
|
|
4
|
+
* @param {string} digits
|
|
5
|
+
* @return {void}
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateOrderKey(key: string, digits?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string | null | undefined} a
|
|
10
|
+
* @param {string | null | undefined} b
|
|
11
|
+
* @param {string=} digits
|
|
12
|
+
* @return {string}
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateKeyBetween(a: string | null | undefined, b: string | null | undefined, digits?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* same preconditions as generateKeysBetween.
|
|
17
|
+
* n >= 0.
|
|
18
|
+
* Returns an array of n distinct keys in sorted order.
|
|
19
|
+
* If a and b are both null, returns [a0, a1, ...]
|
|
20
|
+
* If one or the other is null, returns consecutive "integer"
|
|
21
|
+
* keys. Otherwise, returns relatively short keys between
|
|
22
|
+
* a and b.
|
|
23
|
+
* @param {string | null | undefined} a
|
|
24
|
+
* @param {string | null | undefined} b
|
|
25
|
+
* @param {number} n
|
|
26
|
+
* @param {string} digits
|
|
27
|
+
* @return {string[]}
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateNKeysBetween(a: string | null | undefined, b: string | null | undefined, n: number, digits?: string): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Point = [x: number, y: number, r: number];
|
|
2
|
+
export declare function add([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
|
|
3
|
+
export declare function sub([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
|
|
4
|
+
export declare function smul([x, y, r]: Point, s: number): Point;
|
|
5
|
+
export declare function norm([x, y, r]: Point): Point;
|
|
6
|
+
export declare function rot([x, y, r]: Point, rad: number): Point;
|
|
7
|
+
export declare function plerp(a: Point, b: Point, t: number): Point;
|
|
8
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
|
9
|
+
export declare function angle(p: Point, p1: Point, p2: Point): number;
|
|
10
|
+
export declare function normAngle(a: number): number;
|
|
11
|
+
export declare function mag([x, y]: Point): number;
|
|
12
|
+
export declare function dist([ax, ay]: Point, [bx, by]: Point): number;
|
|
13
|
+
export declare function getCircleAndPerpendicularLineIntersectionsAtPoint(point: Point, direction: Point, radius: number): [Point, Point];
|
|
14
|
+
export declare function runLength(ps: Point[]): number;
|
|
15
|
+
export declare const clamp: (v: number, min: number, max: number) => number;
|
|
16
|
+
export declare function distancePointToSegment(p3: Point, p1: Point, p2: Point): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Point } from "./math";
|
|
2
|
+
export type SizeMappingDetails = {
|
|
3
|
+
pressure: number;
|
|
4
|
+
runningLength: number;
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
totalLength: number;
|
|
7
|
+
};
|
|
8
|
+
export type LaserPointerOptions = {
|
|
9
|
+
size: number;
|
|
10
|
+
streamline: number;
|
|
11
|
+
simplify: number;
|
|
12
|
+
simplifyPhase: "tail" | "output" | "input";
|
|
13
|
+
keepHead: boolean;
|
|
14
|
+
sizeMapping: (details: SizeMappingDetails) => number;
|
|
15
|
+
};
|
|
16
|
+
export declare class LaserPointer {
|
|
17
|
+
static defaults: LaserPointerOptions;
|
|
18
|
+
static constants: {
|
|
19
|
+
cornerDetectionMaxAngle: number;
|
|
20
|
+
cornerDetectionVariance: (s: number) => 1 | 0.5;
|
|
21
|
+
maxTailLength: number;
|
|
22
|
+
};
|
|
23
|
+
options: LaserPointerOptions;
|
|
24
|
+
constructor(options: Partial<LaserPointerOptions>);
|
|
25
|
+
originalPoints: Point[];
|
|
26
|
+
private stablePoints;
|
|
27
|
+
private tailPoints;
|
|
28
|
+
private isFresh;
|
|
29
|
+
private get lastPoint();
|
|
30
|
+
addPoint(point: Point): void;
|
|
31
|
+
close(): void;
|
|
32
|
+
stabilizeTail(): void;
|
|
33
|
+
private getSize;
|
|
34
|
+
getStrokeOutline(sizeOverride?: number | undefined): Point[];
|
|
35
|
+
}
|
|
@@ -12,7 +12,10 @@ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c:
|
|
|
12
12
|
/**
|
|
13
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
14
14
|
*/
|
|
15
|
-
export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point
|
|
15
|
+
export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>, opts?: {
|
|
16
|
+
tolerance?: number;
|
|
17
|
+
iterLimit?: number;
|
|
18
|
+
}): Point[];
|
|
16
19
|
/**
|
|
17
20
|
* Finds the closest point on the Bezier curve from another point
|
|
18
21
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types";
|
|
1
|
+
import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector, GlobalCoord, LocalCoord } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Create a properly typed Point instance from the X and Y coordinates.
|
|
4
4
|
*
|
|
@@ -7,6 +7,11 @@ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types"
|
|
|
7
7
|
* @returns The branded and created point
|
|
8
8
|
*/
|
|
9
9
|
export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(x: number, y: number): Point;
|
|
10
|
+
export declare function pointFrom<Coord extends GlobalCoord | LocalCoord>(coords: Coord): Coord extends GlobalCoord ? GlobalPoint : LocalPoint;
|
|
11
|
+
export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(coords: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}): Point;
|
|
10
15
|
/**
|
|
11
16
|
* Converts and remaps an array containing a pair of numbers to Point.
|
|
12
17
|
*
|
|
@@ -52,7 +57,7 @@ export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: P
|
|
|
52
57
|
* @param angle The radians to rotate the point by
|
|
53
58
|
* @returns The rotated point
|
|
54
59
|
*/
|
|
55
|
-
export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>(
|
|
60
|
+
export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>(point: Point, center: Point, angle: Radians): Point;
|
|
56
61
|
/**
|
|
57
62
|
* Rotate a point by [angle] degree.
|
|
58
63
|
*
|
|
@@ -120,3 +125,4 @@ export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(
|
|
|
120
125
|
* @returns TRUE if q is indeed between p and r
|
|
121
126
|
*/
|
|
122
127
|
export declare const isPointWithinBounds: <P extends GlobalPoint | LocalPoint>(p: P, q: P, r: P) => boolean;
|
|
128
|
+
export declare const isValidPoint: (point: unknown) => point is LocalPoint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalPoint, LocalPoint, Polygon } from "./types";
|
|
2
2
|
export declare function polygon<Point extends GlobalPoint | LocalPoint>(...points: Point[]): Polygon<Point>;
|
|
3
3
|
export declare function polygonFromPoints<Point extends GlobalPoint | LocalPoint>(points: Point[]): Polygon<Point>;
|
|
4
|
-
export declare const polygonIncludesPoint: <Point extends
|
|
4
|
+
export declare const polygonIncludesPoint: <Point extends LocalPoint | GlobalPoint>(point: Point, polygon: Polygon<Point>) => boolean;
|
|
5
5
|
export declare const polygonIncludesPointNonZero: <Point extends [number, number]>(point: Point, polygon: Point[]) => boolean;
|
|
6
|
-
export declare const pointOnPolygon: <Point extends
|
|
6
|
+
export declare const pointOnPolygon: <Point extends LocalPoint | GlobalPoint>(p: Point, poly: Polygon<Point>, threshold?: number) => boolean;
|
|
@@ -13,9 +13,7 @@ export declare function rangeInclusive(start: number, end: number): InclusiveRan
|
|
|
13
13
|
* @param pair The number pair to convert to an inclusive range
|
|
14
14
|
* @returns The new inclusive range
|
|
15
15
|
*/
|
|
16
|
-
export declare function rangeInclusiveFromPair(pair: [start: number, end: number]):
|
|
17
|
-
_brand: "excalimath_degree";
|
|
18
|
-
};
|
|
16
|
+
export declare function rangeInclusiveFromPair(pair: [start: number, end: number]): InclusiveRange;
|
|
19
17
|
/**
|
|
20
18
|
* Given two ranges, return if the two ranges overlap with each other e.g.
|
|
21
19
|
* [1, 3] overlaps with [2, 4] while [1, 3] does not overlap with [4, 5].
|
|
@@ -21,14 +21,14 @@ export declare const isLineSegment: <Point extends GlobalPoint | LocalPoint>(seg
|
|
|
21
21
|
* @param origin
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare const lineSegmentRotate: <Point extends
|
|
24
|
+
export declare const lineSegmentRotate: <Point extends LocalPoint | GlobalPoint>(l: LineSegment<Point>, angle: Radians, origin?: Point) => LineSegment<Point>;
|
|
25
25
|
/**
|
|
26
26
|
* Calculates the point two line segments with a definite start and end point
|
|
27
27
|
* intersect at.
|
|
28
28
|
*/
|
|
29
29
|
export declare const segmentsIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
|
|
30
|
-
export declare const pointOnLineSegment: <Point extends
|
|
31
|
-
export declare const distanceToLineSegment: <Point extends
|
|
30
|
+
export declare const pointOnLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
|
|
31
|
+
export declare const distanceToLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>) => number;
|
|
32
32
|
/**
|
|
33
33
|
* Returns the intersection point of a segment and a line
|
|
34
34
|
*
|
|
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
|
|
|
37
37
|
* @returns
|
|
38
38
|
*/
|
|
39
39
|
export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
|
|
40
|
+
export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
|
|
@@ -19,12 +19,24 @@ export type InclusiveRange = [number, number] & {
|
|
|
19
19
|
_brand: "excalimath_degree";
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* Represents a 2D position in world
|
|
22
|
+
* Represents a 2D position in world/canvas/scene space. A
|
|
23
23
|
* global coordinate.
|
|
24
24
|
*/
|
|
25
25
|
export type GlobalPoint = [x: number, y: number] & {
|
|
26
26
|
_brand: "excalimath__globalpoint";
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Represents a 2D position in world/canvas/scene space. A
|
|
30
|
+
* global coordinate.
|
|
31
|
+
*
|
|
32
|
+
* TODO remove this once we migrate the codebase to use Point tuples everywhere
|
|
33
|
+
*/
|
|
34
|
+
export type GlobalCoord = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} & {
|
|
38
|
+
_brand: "excalimath__globalcoord";
|
|
39
|
+
};
|
|
28
40
|
/**
|
|
29
41
|
* Represents a 2D position in whatever local space it's
|
|
30
42
|
* needed. A local coordinate.
|
|
@@ -32,6 +44,18 @@ export type GlobalPoint = [x: number, y: number] & {
|
|
|
32
44
|
export type LocalPoint = [x: number, y: number] & {
|
|
33
45
|
_brand: "excalimath__localpoint";
|
|
34
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Represents a 2D position in whatever local space it's needed.
|
|
49
|
+
* A local coordinate.
|
|
50
|
+
*
|
|
51
|
+
* TODO remove this once we migrate the codebase to use Point tuples everywhere
|
|
52
|
+
*/
|
|
53
|
+
export type LocalCoord = {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
} & {
|
|
57
|
+
_brand: "excalimath__localcoord";
|
|
58
|
+
};
|
|
35
59
|
/**
|
|
36
60
|
* A line is an infinitely long object with no width, depth, or curvature.
|
|
37
61
|
*/
|
|
@@ -15,7 +15,7 @@ type ExportOpts = {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, exportingFrame, }: ExportOpts & {
|
|
18
|
-
exportPadding?: number
|
|
18
|
+
exportPadding?: number;
|
|
19
19
|
}) => Promise<HTMLCanvasElement>;
|
|
20
20
|
export declare const exportToBlob: (opts: ExportOpts & {
|
|
21
21
|
mimeType?: string;
|
|
@@ -23,10 +23,10 @@ export declare const exportToBlob: (opts: ExportOpts & {
|
|
|
23
23
|
exportPadding?: number;
|
|
24
24
|
}) => Promise<Blob>;
|
|
25
25
|
export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, exportingFrame, skipInliningFonts, reuseImages, }: Omit<ExportOpts, "getDimensions"> & {
|
|
26
|
-
exportPadding?: number
|
|
27
|
-
renderEmbeddables?: boolean
|
|
28
|
-
skipInliningFonts?: true
|
|
29
|
-
reuseImages?: boolean
|
|
26
|
+
exportPadding?: number;
|
|
27
|
+
renderEmbeddables?: boolean;
|
|
28
|
+
skipInliningFonts?: true;
|
|
29
|
+
reuseImages?: boolean;
|
|
30
30
|
}) => Promise<SVGSVGElement>;
|
|
31
31
|
export declare const exportToClipboard: (opts: ExportOpts & {
|
|
32
32
|
mimeType?: string;
|
|
@@ -46,13 +46,13 @@ export declare const getClosedCurveShape: <Point extends GlobalPoint | LocalPoin
|
|
|
46
46
|
* @param gap Optional value to inflate the shape before testing
|
|
47
47
|
* @returns An array of intersections
|
|
48
48
|
*/
|
|
49
|
-
export declare const segmentIntersectRectangleElement: <Point extends
|
|
50
|
-
export declare const pointOnEllipse: <Point extends
|
|
51
|
-
export declare const pointInEllipse: <Point extends
|
|
52
|
-
export declare const ellipseAxes: <Point extends
|
|
49
|
+
export declare const segmentIntersectRectangleElement: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawBindableElement, segment: LineSegment<Point>, gap?: number) => Point[];
|
|
50
|
+
export declare const pointOnEllipse: <Point extends LocalPoint | GlobalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
|
|
51
|
+
export declare const pointInEllipse: <Point extends LocalPoint | GlobalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
|
|
52
|
+
export declare const ellipseAxes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => {
|
|
53
53
|
majorAxis: number;
|
|
54
54
|
minorAxis: number;
|
|
55
55
|
};
|
|
56
|
-
export declare const ellipseFocusToCenter: <Point extends
|
|
57
|
-
export declare const ellipseExtremes: <Point extends
|
|
56
|
+
export declare const ellipseFocusToCenter: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => number;
|
|
57
|
+
export declare const ellipseExtremes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => import("@excalidraw/math").Vector[];
|
|
58
58
|
export {};
|