@excalidraw/excalidraw 0.17.1-7441-0269e5a → 0.17.1-7441-4c9a6f4
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/browser/excalidraw-assets/{chunk-V52YQ6TH.js → chunk-LZCCI7PN.js} +1181 -1675
- package/dist/browser/excalidraw-assets/{image-MZHH7VY4.js → image-CG4AV2NT.js} +1 -1
- package/dist/browser/excalidraw-assets/{image-2MHILQWB.css → image-EO7USLQY.css} +1 -1
- package/dist/browser/index.css +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/packages/excalidraw/actions/actionAddToLibrary.js +59 -0
- package/dist/packages/excalidraw/actions/actionAlign.js +124 -0
- package/dist/packages/excalidraw/actions/actionBoundText.js +213 -0
- package/dist/packages/excalidraw/actions/actionCanvas.js +354 -0
- package/dist/packages/excalidraw/actions/actionClipboard.js +221 -0
- package/dist/packages/excalidraw/actions/actionDeleteSelected.js +129 -0
- package/dist/packages/excalidraw/actions/actionDistribute.js +56 -0
- package/dist/packages/excalidraw/actions/actionDuplicateSelection.js +181 -0
- package/dist/packages/excalidraw/actions/actionElementLock.js +89 -0
- package/dist/packages/excalidraw/actions/actionExport.js +195 -0
- package/dist/packages/excalidraw/actions/actionFinalize.js +150 -0
- package/dist/packages/excalidraw/actions/actionFlip.js +52 -0
- package/dist/packages/excalidraw/actions/actionFrame.js +113 -0
- package/dist/packages/excalidraw/actions/actionGroup.js +162 -0
- package/dist/packages/excalidraw/actions/actionHistory.js +57 -0
- package/dist/packages/excalidraw/actions/actionLinearEditor.js +41 -0
- package/dist/packages/excalidraw/actions/actionMenu.js +53 -0
- package/dist/packages/excalidraw/actions/actionNavigate.js +43 -0
- package/dist/packages/excalidraw/actions/actionProperties.js +683 -0
- package/dist/packages/excalidraw/actions/actionSelectAll.js +40 -0
- package/dist/packages/excalidraw/actions/actionStyles.js +118 -0
- package/dist/packages/excalidraw/actions/actionToggleGridMode.js +27 -0
- package/dist/packages/excalidraw/actions/actionToggleObjectsSnapMode.js +26 -0
- package/dist/packages/excalidraw/actions/actionToggleStats.js +19 -0
- package/dist/packages/excalidraw/actions/actionToggleViewMode.js +25 -0
- package/dist/packages/excalidraw/actions/actionToggleZenMode.js +25 -0
- package/dist/packages/excalidraw/actions/actionZindex.js +86 -0
- package/dist/packages/excalidraw/actions/index.js +25 -0
- package/dist/packages/excalidraw/actions/manager.js +110 -0
- package/dist/packages/excalidraw/actions/register.js +5 -0
- package/dist/packages/excalidraw/actions/shortcuts.js +52 -0
- package/dist/packages/excalidraw/align.js +36 -0
- package/dist/packages/excalidraw/analytics.js +30 -0
- package/dist/packages/excalidraw/appState.js +222 -0
- package/dist/packages/excalidraw/charts.js +365 -0
- package/dist/packages/excalidraw/clients.js +34 -0
- package/dist/packages/excalidraw/clipboard.js +351 -0
- package/dist/packages/excalidraw/colors.js +124 -0
- package/dist/packages/excalidraw/components/Actions.js +127 -0
- package/dist/packages/excalidraw/components/Actions.scss +92 -0
- package/dist/packages/excalidraw/components/ActiveConfirmDialog.js +22 -0
- package/dist/packages/excalidraw/components/App.js +6177 -0
- package/dist/packages/excalidraw/components/Avatar.js +15 -0
- package/dist/packages/excalidraw/components/Avatar.scss +7 -0
- package/dist/packages/excalidraw/components/BraveMeasureTextError.js +6 -0
- package/dist/packages/excalidraw/components/Button.js +14 -0
- package/dist/packages/excalidraw/components/Button.scss +7 -0
- package/dist/packages/excalidraw/components/ButtonIconCycle.js +11 -0
- package/dist/packages/excalidraw/components/ButtonIconSelect.js +6 -0
- package/dist/packages/excalidraw/components/ButtonSelect.js +3 -0
- package/dist/packages/excalidraw/components/Card.js +14 -0
- package/dist/packages/excalidraw/components/Card.scss +57 -0
- package/dist/packages/excalidraw/components/CheckboxItem.js +10 -0
- package/dist/packages/excalidraw/components/CheckboxItem.scss +91 -0
- package/dist/packages/excalidraw/components/ColorPicker/ColorInput.js +67 -0
- package/dist/packages/excalidraw/components/ColorPicker/ColorPicker.js +138 -0
- package/dist/packages/excalidraw/components/ColorPicker/ColorPicker.scss +441 -0
- package/dist/packages/excalidraw/components/ColorPicker/CustomColorList.js +24 -0
- package/dist/packages/excalidraw/components/ColorPicker/HotkeyLabel.js +8 -0
- package/dist/packages/excalidraw/components/ColorPicker/Picker.js +86 -0
- package/dist/packages/excalidraw/components/ColorPicker/PickerColorList.js +33 -0
- package/dist/packages/excalidraw/components/ColorPicker/PickerHeading.js +3 -0
- package/dist/packages/excalidraw/components/ColorPicker/ShadeList.js +44 -0
- package/dist/packages/excalidraw/components/ColorPicker/TopPicks.js +27 -0
- package/dist/packages/excalidraw/components/ColorPicker/colorPickerUtils.js +83 -0
- package/dist/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.js +174 -0
- package/dist/packages/excalidraw/components/ConfirmDialog.js +27 -0
- package/dist/packages/excalidraw/components/ConfirmDialog.scss +11 -0
- package/dist/packages/excalidraw/components/ContextMenu.js +56 -0
- package/dist/packages/excalidraw/components/ContextMenu.scss +98 -0
- package/dist/packages/excalidraw/components/DarkModeToggle.js +16 -0
- package/dist/packages/excalidraw/components/DefaultSidebar.js +48 -0
- package/dist/packages/excalidraw/components/Dialog.js +74 -0
- package/dist/packages/excalidraw/components/Dialog.scss +48 -0
- package/dist/packages/excalidraw/components/DialogActionButton.js +9 -0
- package/dist/packages/excalidraw/components/DialogActionButton.scss +47 -0
- package/dist/packages/excalidraw/components/ErrorDialog.js +18 -0
- package/dist/packages/excalidraw/components/ExcalidrawLogo.js +7 -0
- package/dist/packages/excalidraw/components/ExcalidrawLogo.scss +73 -0
- package/dist/packages/excalidraw/components/ExportDialog.scss +129 -0
- package/dist/packages/excalidraw/components/EyeDropper.js +130 -0
- package/dist/packages/excalidraw/components/EyeDropper.scss +48 -0
- package/dist/packages/excalidraw/components/FilledButton.js +7 -0
- package/dist/packages/excalidraw/components/FilledButton.scss +191 -0
- package/dist/packages/excalidraw/components/FixedSideContainer.js +4 -0
- package/dist/packages/excalidraw/components/FixedSideContainer.scss +40 -0
- package/dist/packages/excalidraw/components/FollowMode/FollowMode.js +7 -0
- package/dist/packages/excalidraw/components/FollowMode/FollowMode.scss +59 -0
- package/dist/packages/excalidraw/components/HandButton.js +9 -0
- package/dist/packages/excalidraw/components/HelpButton.js +4 -0
- package/dist/packages/excalidraw/components/HelpDialog.js +79 -0
- package/dist/packages/excalidraw/components/HelpDialog.scss +130 -0
- package/dist/packages/excalidraw/components/HintViewer.js +97 -0
- package/dist/packages/excalidraw/components/HintViewer.scss +37 -0
- package/dist/packages/excalidraw/components/IconPicker.js +99 -0
- package/dist/packages/excalidraw/components/IconPicker.scss +143 -0
- package/dist/packages/excalidraw/components/ImageExportDialog.js +127 -0
- package/dist/packages/excalidraw/components/ImageExportDialog.scss +173 -0
- package/dist/packages/excalidraw/components/InitializeApp.js +16 -0
- package/dist/packages/excalidraw/components/InlineIcon.js +10 -0
- package/dist/packages/excalidraw/components/Island.js +5 -0
- package/dist/packages/excalidraw/components/Island.scss +16 -0
- package/dist/packages/excalidraw/components/JSONExportDialog.js +35 -0
- package/dist/packages/excalidraw/components/LaserTool/LaserPathManager.js +225 -0
- package/dist/packages/excalidraw/components/LaserTool/LaserPointerButton.js +10 -0
- package/dist/packages/excalidraw/components/LaserTool/LaserTool.js +15 -0
- package/dist/packages/excalidraw/components/LaserTool/LaserToolOverlay.scss +20 -0
- package/dist/packages/excalidraw/components/LayerUI.js +189 -0
- package/dist/packages/excalidraw/components/LayerUI.scss +112 -0
- package/dist/packages/excalidraw/components/LibraryMenu.js +99 -0
- package/dist/packages/excalidraw/components/LibraryMenu.scss +150 -0
- package/dist/packages/excalidraw/components/LibraryMenuBrowseButton.js +8 -0
- package/dist/packages/excalidraw/components/LibraryMenuControlButtons.js +6 -0
- package/dist/packages/excalidraw/components/LibraryMenuHeaderContent.js +126 -0
- package/dist/packages/excalidraw/components/LibraryMenuItems.js +138 -0
- package/dist/packages/excalidraw/components/LibraryMenuItems.scss +99 -0
- package/dist/packages/excalidraw/components/LibraryMenuSection.js +21 -0
- package/dist/packages/excalidraw/components/LibraryUnit.js +52 -0
- package/dist/packages/excalidraw/components/LibraryUnit.scss +185 -0
- package/dist/packages/excalidraw/components/LoadingMessage.js +24 -0
- package/dist/packages/excalidraw/components/LockButton.js +14 -0
- package/dist/packages/excalidraw/components/MagicButton.js +9 -0
- package/dist/packages/excalidraw/components/MagicSettings.js +46 -0
- package/dist/packages/excalidraw/components/MagicSettings.scss +18 -0
- package/dist/packages/excalidraw/components/MobileMenu.js +45 -0
- package/dist/packages/excalidraw/components/Modal.js +23 -0
- package/dist/packages/excalidraw/components/Modal.scss +121 -0
- package/dist/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.js +31 -0
- package/dist/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm.scss +126 -0
- package/dist/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.js +32 -0
- package/dist/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.js +19 -0
- package/dist/packages/excalidraw/components/Paragraph.js +4 -0
- package/dist/packages/excalidraw/components/PasteChartDialog.js +63 -0
- package/dist/packages/excalidraw/components/PasteChartDialog.scss +46 -0
- package/dist/packages/excalidraw/components/PenModeButton.js +13 -0
- package/dist/packages/excalidraw/components/Popover.js +111 -0
- package/dist/packages/excalidraw/components/Popover.scss +8 -0
- package/dist/packages/excalidraw/components/ProjectName.js +30 -0
- package/dist/packages/excalidraw/components/ProjectName.scss +25 -0
- package/dist/packages/excalidraw/components/PublishLibrary.js +214 -0
- package/dist/packages/excalidraw/components/PublishLibrary.scss +172 -0
- package/dist/packages/excalidraw/components/RadioGroup.js +8 -0
- package/dist/packages/excalidraw/components/RadioGroup.scss +91 -0
- package/dist/packages/excalidraw/components/Section.js +8 -0
- package/dist/packages/excalidraw/components/ShareableLinkDialog.js +33 -0
- package/dist/packages/excalidraw/components/ShareableLinkDialog.scss +91 -0
- package/dist/packages/excalidraw/components/Sidebar/Sidebar.js +145 -0
- package/dist/packages/excalidraw/components/Sidebar/Sidebar.scss +176 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarHeader.js +16 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTab.js +6 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTabTrigger.js +6 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTabTriggers.js +6 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTabs.js +17 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTrigger.js +18 -0
- package/dist/packages/excalidraw/components/Sidebar/SidebarTrigger.scss +37 -0
- package/dist/packages/excalidraw/components/Sidebar/common.js +2 -0
- package/dist/packages/excalidraw/components/Spinner.js +14 -0
- package/dist/packages/excalidraw/components/Spinner.scss +49 -0
- package/dist/packages/excalidraw/components/Stack.js +24 -0
- package/dist/packages/excalidraw/components/Stack.scss +19 -0
- package/dist/packages/excalidraw/components/Stats.js +13 -0
- package/dist/packages/excalidraw/components/Stats.scss +54 -0
- package/dist/packages/excalidraw/components/Switch.js +10 -0
- package/dist/packages/excalidraw/components/Switch.scss +118 -0
- package/dist/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.js +58 -0
- package/dist/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.scss +10 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialog.js +194 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialog.scss +315 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogInput.js +28 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogOutput.js +8 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogPanel.js +11 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogPanels.js +4 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.js +5 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogTab.js +6 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogTabTrigger.js +6 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogTabTriggers.js +6 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogTabs.js +39 -0
- package/dist/packages/excalidraw/components/TTDDialog/TTDDialogTrigger.js +16 -0
- package/dist/packages/excalidraw/components/TTDDialog/common.js +88 -0
- package/dist/packages/excalidraw/components/TextField.js +25 -0
- package/dist/packages/excalidraw/components/TextField.scss +109 -0
- package/dist/packages/excalidraw/components/TextInput.scss +7 -0
- package/dist/packages/excalidraw/components/Toast.js +30 -0
- package/dist/packages/excalidraw/components/Toast.scss +49 -0
- package/dist/packages/excalidraw/components/ToolButton.js +72 -0
- package/dist/packages/excalidraw/components/ToolIcon.scss +184 -0
- package/dist/packages/excalidraw/components/Toolbar.scss +50 -0
- package/dist/packages/excalidraw/components/Tooltip.js +60 -0
- package/dist/packages/excalidraw/components/Tooltip.scss +47 -0
- package/dist/packages/excalidraw/components/Trans.js +139 -0
- package/dist/packages/excalidraw/components/UserList.js +96 -0
- package/dist/packages/excalidraw/components/UserList.scss +136 -0
- package/dist/packages/excalidraw/components/canvases/InteractiveCanvas.js +120 -0
- package/dist/packages/excalidraw/components/canvases/StaticCanvas.js +85 -0
- package/dist/packages/excalidraw/components/canvases/index.js +3 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenu.js +24 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenu.scss +148 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuContent.js +21 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuGroup.js +6 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuItem.js +23 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuItemContent.js +7 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.js +5 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuItemLink.js +9 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuSeparator.js +8 -0
- package/dist/packages/excalidraw/components/dropdownMenu/DropdownMenuTrigger.js +12 -0
- package/dist/packages/excalidraw/components/dropdownMenu/common.js +20 -0
- package/dist/packages/excalidraw/components/dropdownMenu/dropdownMenuUtils.js +27 -0
- package/dist/packages/excalidraw/components/footer/Footer.js +25 -0
- package/dist/packages/excalidraw/components/footer/FooterCenter.js +14 -0
- package/dist/packages/excalidraw/components/footer/FooterCenter.scss +11 -0
- package/dist/packages/excalidraw/components/hoc/withInternalFallback.js +57 -0
- package/dist/packages/excalidraw/components/icons.js +220 -0
- package/dist/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.js +13 -0
- package/dist/packages/excalidraw/components/live-collaboration/LiveCollaborationTrigger.scss +72 -0
- package/dist/packages/excalidraw/components/main-menu/DefaultItems.js +116 -0
- package/dist/packages/excalidraw/components/main-menu/DefaultItems.scss +21 -0
- package/dist/packages/excalidraw/components/main-menu/MainMenu.js +36 -0
- package/dist/packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.js +69 -0
- package/dist/packages/excalidraw/components/welcome-screen/WelcomeScreen.Hints.js +20 -0
- package/dist/packages/excalidraw/components/welcome-screen/WelcomeScreen.js +11 -0
- package/dist/packages/excalidraw/components/welcome-screen/WelcomeScreen.scss +285 -0
- package/dist/packages/excalidraw/constants.js +312 -0
- package/dist/packages/excalidraw/context/tunnels.js +21 -0
- package/dist/packages/excalidraw/context/ui-appState.js +3 -0
- package/dist/packages/excalidraw/css/app.scss +39 -0
- package/dist/packages/excalidraw/css/styles.scss +757 -0
- package/dist/packages/excalidraw/css/theme.scss +252 -0
- package/dist/packages/excalidraw/css/variables.module.scss +174 -0
- package/dist/packages/excalidraw/cursor.js +72 -0
- package/dist/packages/excalidraw/data/EditorLocalStorage.js +42 -0
- package/dist/packages/excalidraw/data/ai/types.js +1 -0
- package/dist/packages/excalidraw/data/blob.js +378 -0
- package/dist/packages/excalidraw/data/encode.js +231 -0
- package/dist/packages/excalidraw/data/encryption.js +53 -0
- package/dist/packages/excalidraw/data/filesystem.js +65 -0
- package/dist/packages/excalidraw/data/image.js +91 -0
- package/dist/packages/excalidraw/data/index.js +120 -0
- package/dist/packages/excalidraw/data/json.js +93 -0
- package/dist/packages/excalidraw/data/library.js +376 -0
- package/dist/packages/excalidraw/data/magic.js +73 -0
- package/dist/packages/excalidraw/data/resave.js +22 -0
- package/dist/packages/excalidraw/data/restore.js +438 -0
- package/dist/packages/excalidraw/data/transform.js +442 -0
- package/dist/packages/excalidraw/data/types.js +1 -0
- package/dist/packages/excalidraw/data/url.js +30 -0
- package/dist/packages/excalidraw/distribute.js +58 -0
- package/dist/packages/excalidraw/element/ElementCanvasButtons.js +31 -0
- package/dist/packages/excalidraw/element/ElementCanvasButtons.scss +14 -0
- package/dist/packages/excalidraw/element/Hyperlink.js +350 -0
- package/dist/packages/excalidraw/element/Hyperlink.scss +70 -0
- package/dist/packages/excalidraw/element/binding.js +412 -0
- package/dist/packages/excalidraw/element/bounds.js +613 -0
- package/dist/packages/excalidraw/element/collision.js +727 -0
- package/dist/packages/excalidraw/element/dragElements.js +119 -0
- package/dist/packages/excalidraw/element/embeddable.js +305 -0
- package/dist/packages/excalidraw/element/image.js +91 -0
- package/dist/packages/excalidraw/element/index.js +24 -0
- package/dist/packages/excalidraw/element/linearElementEditor.js +867 -0
- package/dist/packages/excalidraw/element/mutateElement.js +112 -0
- package/dist/packages/excalidraw/element/newElement.js +389 -0
- package/dist/packages/excalidraw/element/resizeElements.js +597 -0
- package/dist/packages/excalidraw/element/resizeTest.js +95 -0
- package/dist/packages/excalidraw/element/showSelectedShapeActions.js +9 -0
- package/dist/packages/excalidraw/element/sizeHelpers.js +131 -0
- package/dist/packages/excalidraw/element/sortElements.js +104 -0
- package/dist/packages/excalidraw/element/textElement.js +716 -0
- package/dist/packages/excalidraw/element/textWysiwyg.js +500 -0
- package/dist/packages/excalidraw/element/transformHandles.js +155 -0
- package/dist/packages/excalidraw/element/typeChecks.js +141 -0
- package/dist/packages/excalidraw/element/types.js +1 -0
- package/dist/packages/excalidraw/emitter.js +36 -0
- package/dist/packages/excalidraw/errors.js +20 -0
- package/dist/packages/excalidraw/frame.js +373 -0
- package/dist/packages/excalidraw/ga.js +268 -0
- package/dist/packages/excalidraw/gadirections.js +18 -0
- package/dist/packages/excalidraw/galines.js +32 -0
- package/dist/packages/excalidraw/gapoints.js +30 -0
- package/dist/packages/excalidraw/gatransforms.js +23 -0
- package/dist/packages/excalidraw/gesture.js +9 -0
- package/dist/packages/excalidraw/groups.js +225 -0
- package/dist/packages/excalidraw/history.js +190 -0
- package/dist/packages/excalidraw/hooks/useCallbackRefState.js +6 -0
- package/dist/packages/excalidraw/hooks/useCreatePortalContainer.js +32 -0
- package/dist/packages/excalidraw/hooks/useLibraryItemSvg.js +62 -0
- package/dist/packages/excalidraw/hooks/useOutsideClick.js +67 -0
- package/dist/packages/excalidraw/hooks/useScrollPosition.js +23 -0
- package/dist/packages/excalidraw/hooks/useStable.js +6 -0
- package/dist/packages/excalidraw/hooks/useTransition.js +7 -0
- package/dist/packages/excalidraw/i18n.js +137 -0
- package/dist/packages/excalidraw/index-node.d.ts +1 -0
- package/dist/packages/excalidraw/index-node.js +73 -0
- package/{types → dist/packages}/excalidraw/index.d.ts +1 -1
- package/dist/packages/excalidraw/index.js +116 -0
- package/dist/packages/excalidraw/jotai.js +18 -0
- package/dist/packages/excalidraw/keys.js +84 -0
- package/dist/packages/excalidraw/locales/ar-SA.json +525 -0
- package/dist/packages/excalidraw/locales/az-AZ.json +525 -0
- package/dist/packages/excalidraw/locales/bg-BG.json +525 -0
- package/dist/packages/excalidraw/locales/bn-BD.json +525 -0
- package/dist/packages/excalidraw/locales/ca-ES.json +525 -0
- package/dist/packages/excalidraw/locales/cs-CZ.json +525 -0
- package/dist/packages/excalidraw/locales/da-DK.json +525 -0
- package/dist/packages/excalidraw/locales/de-DE.json +525 -0
- package/dist/packages/excalidraw/locales/el-GR.json +525 -0
- package/dist/packages/excalidraw/locales/en.json +535 -0
- package/dist/packages/excalidraw/locales/es-ES.json +525 -0
- package/dist/packages/excalidraw/locales/eu-ES.json +525 -0
- package/dist/packages/excalidraw/locales/fa-IR.json +525 -0
- package/dist/packages/excalidraw/locales/fi-FI.json +525 -0
- package/dist/packages/excalidraw/locales/fr-FR.json +525 -0
- package/dist/packages/excalidraw/locales/gl-ES.json +525 -0
- package/dist/packages/excalidraw/locales/he-IL.json +525 -0
- package/dist/packages/excalidraw/locales/hi-IN.json +525 -0
- package/dist/packages/excalidraw/locales/hu-HU.json +525 -0
- package/dist/packages/excalidraw/locales/id-ID.json +525 -0
- package/dist/packages/excalidraw/locales/it-IT.json +525 -0
- package/dist/packages/excalidraw/locales/ja-JP.json +525 -0
- package/dist/packages/excalidraw/locales/kaa.json +525 -0
- package/dist/packages/excalidraw/locales/kab-KAB.json +525 -0
- package/dist/packages/excalidraw/locales/kk-KZ.json +525 -0
- package/dist/packages/excalidraw/locales/km-KH.json +525 -0
- package/dist/packages/excalidraw/locales/ko-KR.json +525 -0
- package/dist/packages/excalidraw/locales/ku-TR.json +525 -0
- package/dist/packages/excalidraw/locales/lt-LT.json +525 -0
- package/dist/packages/excalidraw/locales/lv-LV.json +525 -0
- package/dist/packages/excalidraw/locales/mr-IN.json +525 -0
- package/dist/packages/excalidraw/locales/my-MM.json +525 -0
- package/dist/packages/excalidraw/locales/nb-NO.json +525 -0
- package/dist/packages/excalidraw/locales/nl-NL.json +525 -0
- package/dist/packages/excalidraw/locales/nn-NO.json +525 -0
- package/dist/packages/excalidraw/locales/oc-FR.json +525 -0
- package/dist/packages/excalidraw/locales/pa-IN.json +525 -0
- package/dist/packages/excalidraw/locales/percentages.json +56 -0
- package/dist/packages/excalidraw/locales/pl-PL.json +525 -0
- package/dist/packages/excalidraw/locales/pt-BR.json +525 -0
- package/dist/packages/excalidraw/locales/pt-PT.json +525 -0
- package/dist/packages/excalidraw/locales/ro-RO.json +525 -0
- package/dist/packages/excalidraw/locales/ru-RU.json +525 -0
- package/dist/packages/excalidraw/locales/si-LK.json +525 -0
- package/dist/packages/excalidraw/locales/sk-SK.json +525 -0
- package/dist/packages/excalidraw/locales/sl-SI.json +525 -0
- package/dist/packages/excalidraw/locales/sv-SE.json +525 -0
- package/dist/packages/excalidraw/locales/ta-IN.json +525 -0
- package/dist/packages/excalidraw/locales/th-TH.json +525 -0
- package/dist/packages/excalidraw/locales/tr-TR.json +525 -0
- package/dist/packages/excalidraw/locales/uk-UA.json +525 -0
- package/dist/packages/excalidraw/locales/vi-VN.json +525 -0
- package/dist/packages/excalidraw/locales/zh-CN.json +525 -0
- package/dist/packages/excalidraw/locales/zh-HK.json +525 -0
- package/dist/packages/excalidraw/locales/zh-TW.json +525 -0
- package/dist/packages/excalidraw/math.js +364 -0
- package/dist/packages/excalidraw/points.js +38 -0
- package/dist/packages/excalidraw/polyfill.js +32 -0
- package/dist/packages/excalidraw/random.js +11 -0
- package/dist/packages/excalidraw/renderer/renderElement.js +871 -0
- package/dist/packages/excalidraw/renderer/renderScene.js +859 -0
- package/dist/packages/excalidraw/renderer/renderSnaps.js +114 -0
- package/dist/packages/excalidraw/renderer/roundRect.js +28 -0
- package/dist/packages/excalidraw/scene/Fonts.js +71 -0
- package/dist/packages/excalidraw/scene/Renderer.js +65 -0
- package/dist/packages/excalidraw/scene/Scene.js +230 -0
- package/dist/packages/excalidraw/scene/Shape.js +322 -0
- package/dist/packages/excalidraw/scene/ShapeCache.js +42 -0
- package/dist/packages/excalidraw/scene/comparisons.js +67 -0
- package/dist/packages/excalidraw/scene/export.js +304 -0
- package/dist/packages/excalidraw/scene/index.js +5 -0
- package/dist/packages/excalidraw/scene/scroll.js +35 -0
- package/dist/packages/excalidraw/scene/scrollbars.js +85 -0
- package/dist/packages/excalidraw/scene/selection.js +134 -0
- package/dist/packages/excalidraw/scene/types.js +1 -0
- package/dist/packages/excalidraw/scene/zoom.js +22 -0
- package/dist/packages/excalidraw/shapes.js +84 -0
- package/dist/packages/excalidraw/snapping.js +838 -0
- package/dist/packages/excalidraw/types.js +6 -0
- package/dist/packages/excalidraw/utility-types.js +1 -0
- package/dist/packages/excalidraw/utils.js +668 -0
- package/dist/packages/excalidraw/zindex.js +349 -0
- package/dist/packages/utils/bbox.js +42 -0
- package/dist/packages/utils/export.js +109 -0
- package/dist/packages/utils/withinBounds.js +125 -0
- package/dist/public/fonts/Assistant-Bold.woff2 +0 -0
- package/dist/public/fonts/Assistant-Medium.woff2 +0 -0
- package/dist/public/fonts/Assistant-Regular.woff2 +0 -0
- package/dist/public/fonts/Assistant-SemiBold.woff2 +0 -0
- package/dist/public/fonts/Cascadia.ttf +0 -0
- package/dist/public/fonts/Cascadia.woff2 +0 -0
- package/dist/public/fonts/FG_Virgil.ttf +0 -0
- package/dist/public/fonts/FG_Virgil.woff2 +0 -0
- package/dist/public/fonts/Virgil.woff2 +0 -0
- package/dist/public/fonts/fonts.css +38 -0
- package/package.json +8 -5
- package/dist/index.css +0 -5796
- package/dist/index.js +0 -71898
- /package/{types → dist/packages}/excalidraw/actions/actionAddToLibrary.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionAlign.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionBoundText.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionCanvas.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionClipboard.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionDeleteSelected.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionDistribute.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionDuplicateSelection.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionElementLock.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionExport.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionFinalize.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionFlip.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionFrame.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionGroup.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionHistory.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionLinearEditor.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionNavigate.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionProperties.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionSelectAll.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionStyles.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionToggleGridMode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionToggleStats.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionToggleViewMode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionToggleZenMode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/actionZindex.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/index.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/manager.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/register.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/shortcuts.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/actions/types.d.ts +0 -0
- /package/{types/excalidraw/index-node.d.ts → dist/packages/excalidraw/actions/types.js} +0 -0
- /package/{types → dist/packages}/excalidraw/align.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/analytics.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/appState.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/charts.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/clients.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/clipboard.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/colors.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Actions.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ActiveConfirmDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/App.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Avatar.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/BraveMeasureTextError.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Button.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ButtonIconCycle.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ButtonIconSelect.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ButtonSelect.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Card.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/CheckboxItem.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/ColorInput.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/CustomColorList.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/Picker.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/PickerColorList.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/PickerHeading.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/ShadeList.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/TopPicks.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ConfirmDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ContextMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/DarkModeToggle.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/DefaultSidebar.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Dialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/DialogActionButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ErrorDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ExcalidrawLogo.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/EyeDropper.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/FilledButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/FixedSideContainer.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/FollowMode/FollowMode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/HandButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/HelpButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/HelpDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/HintViewer.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/IconPicker.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ImageExportDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/InitializeApp.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/InlineIcon.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Island.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/JSONExportDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LaserTool/LaserPathManager.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LaserTool/LaserPointerButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LaserTool/LaserTool.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LayerUI.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenuBrowseButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenuControlButtons.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenuHeaderContent.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenuItems.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryMenuSection.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LibraryUnit.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LoadingMessage.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/LockButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/MagicButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/MagicSettings.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/MobileMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Modal.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Paragraph.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/PasteChartDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/PenModeButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Popover.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ProjectName.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/PublishLibrary.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/RadioGroup.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Section.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ShareableLinkDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/Sidebar.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarHeader.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarTab.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarTabs.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/SidebarTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Sidebar/common.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Spinner.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Stack.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Stats.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Switch.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialog.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TTDDialog/common.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/TextField.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Toast.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/ToolButton.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Tooltip.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/Trans.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/UserList.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/canvases/StaticCanvas.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/canvases/index.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/common.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/footer/Footer.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/footer/FooterCenter.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/hoc/withInternalFallback.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/icons.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/main-menu/DefaultItems.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/main-menu/MainMenu.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/constants.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/context/tunnels.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/context/ui-appState.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/cursor.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/EditorLocalStorage.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/ai/types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/blob.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/encode.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/encryption.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/filesystem.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/image.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/index.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/json.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/library.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/magic.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/resave.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/restore.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/transform.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/data/url.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/distribute.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/ElementCanvasButtons.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/Hyperlink.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/binding.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/bounds.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/collision.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/dragElements.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/embeddable.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/image.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/index.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/linearElementEditor.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/mutateElement.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/newElement.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/resizeElements.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/resizeTest.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/showSelectedShapeActions.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/sizeHelpers.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/sortElements.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/textElement.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/textWysiwyg.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/transformHandles.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/typeChecks.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/element/types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/emitter.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/errors.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/frame.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/ga.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/gadirections.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/galines.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/gapoints.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/gatransforms.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/gesture.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/groups.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/history.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useCallbackRefState.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useCreatePortalContainer.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useLibraryItemSvg.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useOutsideClick.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useScrollPosition.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useStable.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/hooks/useTransition.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/i18n.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/jotai.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/keys.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/math.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/points.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/polyfill.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/random.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/renderer/renderElement.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/renderer/renderScene.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/renderer/renderSnaps.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/renderer/roundRect.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/Fonts.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/Renderer.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/Scene.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/Shape.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/ShapeCache.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/comparisons.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/export.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/index.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/scroll.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/scrollbars.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/selection.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/scene/zoom.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/shapes.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/snapping.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/utility-types.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/utils.d.ts +0 -0
- /package/{types → dist/packages}/excalidraw/zindex.d.ts +0 -0
- /package/{types → dist/packages}/utils/bbox.d.ts +0 -0
- /package/{types → dist/packages}/utils/export.d.ts +0 -0
- /package/{types → dist/packages}/utils/withinBounds.d.ts +0 -0
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { distance2d, rotate, rotatePoint } from "../math";
|
|
2
|
+
import rough from "roughjs/bin/rough";
|
|
3
|
+
import { generateRoughOptions } from "../scene/Shape";
|
|
4
|
+
import { isArrowElement, isBoundToContainer, isFreeDrawElement, isLinearElement, isTextElement, } from "./typeChecks";
|
|
5
|
+
import { rescalePoints } from "../points";
|
|
6
|
+
import { getBoundTextElement, getContainerElement } from "./textElement";
|
|
7
|
+
import { LinearElementEditor } from "./linearElementEditor";
|
|
8
|
+
import { ShapeCache } from "../scene/ShapeCache";
|
|
9
|
+
import Scene from "../scene/Scene";
|
|
10
|
+
export class ElementBounds {
|
|
11
|
+
static boundsCache = new WeakMap();
|
|
12
|
+
static getBounds(element) {
|
|
13
|
+
const cachedBounds = ElementBounds.boundsCache.get(element);
|
|
14
|
+
if (cachedBounds?.version &&
|
|
15
|
+
cachedBounds.version === element.version &&
|
|
16
|
+
// we don't invalidate cache when we update containers and not labels,
|
|
17
|
+
// which is causing problems down the line. Fix TBA.
|
|
18
|
+
!isBoundToContainer(element)) {
|
|
19
|
+
return cachedBounds.bounds;
|
|
20
|
+
}
|
|
21
|
+
const bounds = ElementBounds.calculateBounds(element);
|
|
22
|
+
// hack to ensure that downstream checks could retrieve element Scene
|
|
23
|
+
// so as to have correctly calculated bounds
|
|
24
|
+
// FIXME remove when we get rid of all the id:Scene / element:Scene mapping
|
|
25
|
+
const shouldCache = Scene.getScene(element);
|
|
26
|
+
if (shouldCache) {
|
|
27
|
+
ElementBounds.boundsCache.set(element, {
|
|
28
|
+
version: element.version,
|
|
29
|
+
bounds,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return bounds;
|
|
33
|
+
}
|
|
34
|
+
static calculateBounds(element) {
|
|
35
|
+
let bounds;
|
|
36
|
+
const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element);
|
|
37
|
+
if (isFreeDrawElement(element)) {
|
|
38
|
+
const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points.map(([x, y]) => rotate(x, y, cx - element.x, cy - element.y, element.angle)));
|
|
39
|
+
return [
|
|
40
|
+
minX + element.x,
|
|
41
|
+
minY + element.y,
|
|
42
|
+
maxX + element.x,
|
|
43
|
+
maxY + element.y,
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
else if (isLinearElement(element)) {
|
|
47
|
+
bounds = getLinearElementRotatedBounds(element, cx, cy);
|
|
48
|
+
}
|
|
49
|
+
else if (element.type === "diamond") {
|
|
50
|
+
const [x11, y11] = rotate(cx, y1, cx, cy, element.angle);
|
|
51
|
+
const [x12, y12] = rotate(cx, y2, cx, cy, element.angle);
|
|
52
|
+
const [x22, y22] = rotate(x1, cy, cx, cy, element.angle);
|
|
53
|
+
const [x21, y21] = rotate(x2, cy, cx, cy, element.angle);
|
|
54
|
+
const minX = Math.min(x11, x12, x22, x21);
|
|
55
|
+
const minY = Math.min(y11, y12, y22, y21);
|
|
56
|
+
const maxX = Math.max(x11, x12, x22, x21);
|
|
57
|
+
const maxY = Math.max(y11, y12, y22, y21);
|
|
58
|
+
bounds = [minX, minY, maxX, maxY];
|
|
59
|
+
}
|
|
60
|
+
else if (element.type === "ellipse") {
|
|
61
|
+
const w = (x2 - x1) / 2;
|
|
62
|
+
const h = (y2 - y1) / 2;
|
|
63
|
+
const cos = Math.cos(element.angle);
|
|
64
|
+
const sin = Math.sin(element.angle);
|
|
65
|
+
const ww = Math.hypot(w * cos, h * sin);
|
|
66
|
+
const hh = Math.hypot(h * cos, w * sin);
|
|
67
|
+
bounds = [cx - ww, cy - hh, cx + ww, cy + hh];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const [x11, y11] = rotate(x1, y1, cx, cy, element.angle);
|
|
71
|
+
const [x12, y12] = rotate(x1, y2, cx, cy, element.angle);
|
|
72
|
+
const [x22, y22] = rotate(x2, y2, cx, cy, element.angle);
|
|
73
|
+
const [x21, y21] = rotate(x2, y1, cx, cy, element.angle);
|
|
74
|
+
const minX = Math.min(x11, x12, x22, x21);
|
|
75
|
+
const minY = Math.min(y11, y12, y22, y21);
|
|
76
|
+
const maxX = Math.max(x11, x12, x22, x21);
|
|
77
|
+
const maxY = Math.max(y11, y12, y22, y21);
|
|
78
|
+
bounds = [minX, minY, maxX, maxY];
|
|
79
|
+
}
|
|
80
|
+
return bounds;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Scene -> Scene coords, but in x1,x2,y1,y2 format.
|
|
84
|
+
//
|
|
85
|
+
// If the element is created from right to left, the width is going to be negative
|
|
86
|
+
// This set of functions retrieves the absolute position of the 4 points.
|
|
87
|
+
export const getElementAbsoluteCoords = (element, includeBoundText = false) => {
|
|
88
|
+
if (isFreeDrawElement(element)) {
|
|
89
|
+
return getFreeDrawElementAbsoluteCoords(element);
|
|
90
|
+
}
|
|
91
|
+
else if (isLinearElement(element)) {
|
|
92
|
+
return LinearElementEditor.getElementAbsoluteCoords(element, includeBoundText);
|
|
93
|
+
}
|
|
94
|
+
else if (isTextElement(element)) {
|
|
95
|
+
const container = getContainerElement(element);
|
|
96
|
+
if (isArrowElement(container)) {
|
|
97
|
+
const coords = LinearElementEditor.getBoundTextElementPosition(container, element);
|
|
98
|
+
return [
|
|
99
|
+
coords.x,
|
|
100
|
+
coords.y,
|
|
101
|
+
coords.x + element.width,
|
|
102
|
+
coords.y + element.height,
|
|
103
|
+
coords.x + element.width / 2,
|
|
104
|
+
coords.y + element.height / 2,
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return [
|
|
109
|
+
element.x,
|
|
110
|
+
element.y,
|
|
111
|
+
element.x + element.width,
|
|
112
|
+
element.y + element.height,
|
|
113
|
+
element.x + element.width / 2,
|
|
114
|
+
element.y + element.height / 2,
|
|
115
|
+
];
|
|
116
|
+
};
|
|
117
|
+
/*
|
|
118
|
+
* for a given element, `getElementLineSegments` returns line segments
|
|
119
|
+
* that can be used for visual collision detection (useful for frames)
|
|
120
|
+
* as opposed to bounding box collision detection
|
|
121
|
+
*/
|
|
122
|
+
export const getElementLineSegments = (element) => {
|
|
123
|
+
const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element);
|
|
124
|
+
const center = [cx, cy];
|
|
125
|
+
if (isLinearElement(element) || isFreeDrawElement(element)) {
|
|
126
|
+
const segments = [];
|
|
127
|
+
let i = 0;
|
|
128
|
+
while (i < element.points.length - 1) {
|
|
129
|
+
segments.push([
|
|
130
|
+
rotatePoint([
|
|
131
|
+
element.points[i][0] + element.x,
|
|
132
|
+
element.points[i][1] + element.y,
|
|
133
|
+
], center, element.angle),
|
|
134
|
+
rotatePoint([
|
|
135
|
+
element.points[i + 1][0] + element.x,
|
|
136
|
+
element.points[i + 1][1] + element.y,
|
|
137
|
+
], center, element.angle),
|
|
138
|
+
]);
|
|
139
|
+
i++;
|
|
140
|
+
}
|
|
141
|
+
return segments;
|
|
142
|
+
}
|
|
143
|
+
const [nw, ne, sw, se, n, s, w, e] = [
|
|
144
|
+
[x1, y1],
|
|
145
|
+
[x2, y1],
|
|
146
|
+
[x1, y2],
|
|
147
|
+
[x2, y2],
|
|
148
|
+
[cx, y1],
|
|
149
|
+
[cx, y2],
|
|
150
|
+
[x1, cy],
|
|
151
|
+
[x2, cy],
|
|
152
|
+
].map((point) => rotatePoint(point, center, element.angle));
|
|
153
|
+
if (element.type === "diamond") {
|
|
154
|
+
return [
|
|
155
|
+
[n, w],
|
|
156
|
+
[n, e],
|
|
157
|
+
[s, w],
|
|
158
|
+
[s, e],
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
if (element.type === "ellipse") {
|
|
162
|
+
return [
|
|
163
|
+
[n, w],
|
|
164
|
+
[n, e],
|
|
165
|
+
[s, w],
|
|
166
|
+
[s, e],
|
|
167
|
+
[n, w],
|
|
168
|
+
[n, e],
|
|
169
|
+
[s, w],
|
|
170
|
+
[s, e],
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
return [
|
|
174
|
+
[nw, ne],
|
|
175
|
+
[sw, se],
|
|
176
|
+
[nw, sw],
|
|
177
|
+
[ne, se],
|
|
178
|
+
[nw, e],
|
|
179
|
+
[sw, e],
|
|
180
|
+
[ne, w],
|
|
181
|
+
[se, w],
|
|
182
|
+
];
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Scene -> Scene coords, but in x1,x2,y1,y2 format.
|
|
186
|
+
*
|
|
187
|
+
* Rectangle here means any rectangular frame, not an excalidraw element.
|
|
188
|
+
*/
|
|
189
|
+
export const getRectangleBoxAbsoluteCoords = (boxSceneCoords) => {
|
|
190
|
+
return [
|
|
191
|
+
boxSceneCoords.x,
|
|
192
|
+
boxSceneCoords.y,
|
|
193
|
+
boxSceneCoords.x + boxSceneCoords.width,
|
|
194
|
+
boxSceneCoords.y + boxSceneCoords.height,
|
|
195
|
+
boxSceneCoords.x + boxSceneCoords.width / 2,
|
|
196
|
+
boxSceneCoords.y + boxSceneCoords.height / 2,
|
|
197
|
+
];
|
|
198
|
+
};
|
|
199
|
+
export const pointRelativeTo = (element, absoluteCoords) => {
|
|
200
|
+
return [absoluteCoords[0] - element.x, absoluteCoords[1] - element.y];
|
|
201
|
+
};
|
|
202
|
+
export const getDiamondPoints = (element) => {
|
|
203
|
+
// Here we add +1 to avoid these numbers to be 0
|
|
204
|
+
// otherwise rough.js will throw an error complaining about it
|
|
205
|
+
const topX = Math.floor(element.width / 2) + 1;
|
|
206
|
+
const topY = 0;
|
|
207
|
+
const rightX = element.width;
|
|
208
|
+
const rightY = Math.floor(element.height / 2) + 1;
|
|
209
|
+
const bottomX = topX;
|
|
210
|
+
const bottomY = element.height;
|
|
211
|
+
const leftX = 0;
|
|
212
|
+
const leftY = rightY;
|
|
213
|
+
return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY];
|
|
214
|
+
};
|
|
215
|
+
export const getCurvePathOps = (shape) => {
|
|
216
|
+
for (const set of shape.sets) {
|
|
217
|
+
if (set.type === "path") {
|
|
218
|
+
return set.ops;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return shape.sets[0].ops;
|
|
222
|
+
};
|
|
223
|
+
// reference: https://eliot-jones.com/2019/12/cubic-bezier-curve-bounding-boxes
|
|
224
|
+
const getBezierValueForT = (t, p0, p1, p2, p3) => {
|
|
225
|
+
const oneMinusT = 1 - t;
|
|
226
|
+
return (Math.pow(oneMinusT, 3) * p0 +
|
|
227
|
+
3 * Math.pow(oneMinusT, 2) * t * p1 +
|
|
228
|
+
3 * oneMinusT * Math.pow(t, 2) * p2 +
|
|
229
|
+
Math.pow(t, 3) * p3);
|
|
230
|
+
};
|
|
231
|
+
const solveQuadratic = (p0, p1, p2, p3) => {
|
|
232
|
+
const i = p1 - p0;
|
|
233
|
+
const j = p2 - p1;
|
|
234
|
+
const k = p3 - p2;
|
|
235
|
+
const a = 3 * i - 6 * j + 3 * k;
|
|
236
|
+
const b = 6 * j - 6 * i;
|
|
237
|
+
const c = 3 * i;
|
|
238
|
+
const sqrtPart = b * b - 4 * a * c;
|
|
239
|
+
const hasSolution = sqrtPart >= 0;
|
|
240
|
+
if (!hasSolution) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
let s1 = null;
|
|
244
|
+
let s2 = null;
|
|
245
|
+
let t1 = Infinity;
|
|
246
|
+
let t2 = Infinity;
|
|
247
|
+
if (a === 0) {
|
|
248
|
+
t1 = t2 = -c / b;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
t1 = (-b + Math.sqrt(sqrtPart)) / (2 * a);
|
|
252
|
+
t2 = (-b - Math.sqrt(sqrtPart)) / (2 * a);
|
|
253
|
+
}
|
|
254
|
+
if (t1 >= 0 && t1 <= 1) {
|
|
255
|
+
s1 = getBezierValueForT(t1, p0, p1, p2, p3);
|
|
256
|
+
}
|
|
257
|
+
if (t2 >= 0 && t2 <= 1) {
|
|
258
|
+
s2 = getBezierValueForT(t2, p0, p1, p2, p3);
|
|
259
|
+
}
|
|
260
|
+
return [s1, s2];
|
|
261
|
+
};
|
|
262
|
+
const getCubicBezierCurveBound = (p0, p1, p2, p3) => {
|
|
263
|
+
const solX = solveQuadratic(p0[0], p1[0], p2[0], p3[0]);
|
|
264
|
+
const solY = solveQuadratic(p0[1], p1[1], p2[1], p3[1]);
|
|
265
|
+
let minX = Math.min(p0[0], p3[0]);
|
|
266
|
+
let maxX = Math.max(p0[0], p3[0]);
|
|
267
|
+
if (solX) {
|
|
268
|
+
const xs = solX.filter((x) => x !== null);
|
|
269
|
+
minX = Math.min(minX, ...xs);
|
|
270
|
+
maxX = Math.max(maxX, ...xs);
|
|
271
|
+
}
|
|
272
|
+
let minY = Math.min(p0[1], p3[1]);
|
|
273
|
+
let maxY = Math.max(p0[1], p3[1]);
|
|
274
|
+
if (solY) {
|
|
275
|
+
const ys = solY.filter((y) => y !== null);
|
|
276
|
+
minY = Math.min(minY, ...ys);
|
|
277
|
+
maxY = Math.max(maxY, ...ys);
|
|
278
|
+
}
|
|
279
|
+
return [minX, minY, maxX, maxY];
|
|
280
|
+
};
|
|
281
|
+
export const getMinMaxXYFromCurvePathOps = (ops, transformXY) => {
|
|
282
|
+
let currentP = [0, 0];
|
|
283
|
+
const { minX, minY, maxX, maxY } = ops.reduce((limits, { op, data }) => {
|
|
284
|
+
// There are only four operation types:
|
|
285
|
+
// move, bcurveTo, lineTo, and curveTo
|
|
286
|
+
if (op === "move") {
|
|
287
|
+
// change starting point
|
|
288
|
+
currentP = data;
|
|
289
|
+
// move operation does not draw anything; so, it always
|
|
290
|
+
// returns false
|
|
291
|
+
}
|
|
292
|
+
else if (op === "bcurveTo") {
|
|
293
|
+
const _p1 = [data[0], data[1]];
|
|
294
|
+
const _p2 = [data[2], data[3]];
|
|
295
|
+
const _p3 = [data[4], data[5]];
|
|
296
|
+
const p1 = transformXY ? transformXY(..._p1) : _p1;
|
|
297
|
+
const p2 = transformXY ? transformXY(..._p2) : _p2;
|
|
298
|
+
const p3 = transformXY ? transformXY(..._p3) : _p3;
|
|
299
|
+
const p0 = transformXY ? transformXY(...currentP) : currentP;
|
|
300
|
+
currentP = _p3;
|
|
301
|
+
const [minX, minY, maxX, maxY] = getCubicBezierCurveBound(p0, p1, p2, p3);
|
|
302
|
+
limits.minX = Math.min(limits.minX, minX);
|
|
303
|
+
limits.minY = Math.min(limits.minY, minY);
|
|
304
|
+
limits.maxX = Math.max(limits.maxX, maxX);
|
|
305
|
+
limits.maxY = Math.max(limits.maxY, maxY);
|
|
306
|
+
}
|
|
307
|
+
else if (op === "lineTo") {
|
|
308
|
+
// TODO: Implement this
|
|
309
|
+
}
|
|
310
|
+
else if (op === "qcurveTo") {
|
|
311
|
+
// TODO: Implement this
|
|
312
|
+
}
|
|
313
|
+
return limits;
|
|
314
|
+
}, { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity });
|
|
315
|
+
return [minX, minY, maxX, maxY];
|
|
316
|
+
};
|
|
317
|
+
export const getBoundsFromPoints = (points) => {
|
|
318
|
+
let minX = Infinity;
|
|
319
|
+
let minY = Infinity;
|
|
320
|
+
let maxX = -Infinity;
|
|
321
|
+
let maxY = -Infinity;
|
|
322
|
+
for (const [x, y] of points) {
|
|
323
|
+
minX = Math.min(minX, x);
|
|
324
|
+
minY = Math.min(minY, y);
|
|
325
|
+
maxX = Math.max(maxX, x);
|
|
326
|
+
maxY = Math.max(maxY, y);
|
|
327
|
+
}
|
|
328
|
+
return [minX, minY, maxX, maxY];
|
|
329
|
+
};
|
|
330
|
+
const getFreeDrawElementAbsoluteCoords = (element) => {
|
|
331
|
+
const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points);
|
|
332
|
+
const x1 = minX + element.x;
|
|
333
|
+
const y1 = minY + element.y;
|
|
334
|
+
const x2 = maxX + element.x;
|
|
335
|
+
const y2 = maxY + element.y;
|
|
336
|
+
return [x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2];
|
|
337
|
+
};
|
|
338
|
+
/** @returns number in pixels */
|
|
339
|
+
export const getArrowheadSize = (arrowhead) => {
|
|
340
|
+
switch (arrowhead) {
|
|
341
|
+
case "arrow":
|
|
342
|
+
return 25;
|
|
343
|
+
case "diamond":
|
|
344
|
+
case "diamond_outline":
|
|
345
|
+
return 12;
|
|
346
|
+
default:
|
|
347
|
+
return 15;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
/** @returns number in degrees */
|
|
351
|
+
export const getArrowheadAngle = (arrowhead) => {
|
|
352
|
+
switch (arrowhead) {
|
|
353
|
+
case "bar":
|
|
354
|
+
return 90;
|
|
355
|
+
case "arrow":
|
|
356
|
+
return 20;
|
|
357
|
+
default:
|
|
358
|
+
return 25;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
export const getArrowheadPoints = (element, shape, position, arrowhead) => {
|
|
362
|
+
const ops = getCurvePathOps(shape[0]);
|
|
363
|
+
if (ops.length < 1) {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
// The index of the bCurve operation to examine.
|
|
367
|
+
const index = position === "start" ? 1 : ops.length - 1;
|
|
368
|
+
const data = ops[index].data;
|
|
369
|
+
const p3 = [data[4], data[5]];
|
|
370
|
+
const p2 = [data[2], data[3]];
|
|
371
|
+
const p1 = [data[0], data[1]];
|
|
372
|
+
// We need to find p0 of the bezier curve.
|
|
373
|
+
// It is typically the last point of the previous
|
|
374
|
+
// curve; it can also be the position of moveTo operation.
|
|
375
|
+
const prevOp = ops[index - 1];
|
|
376
|
+
let p0 = [0, 0];
|
|
377
|
+
if (prevOp.op === "move") {
|
|
378
|
+
p0 = prevOp.data;
|
|
379
|
+
}
|
|
380
|
+
else if (prevOp.op === "bcurveTo") {
|
|
381
|
+
p0 = [prevOp.data[4], prevOp.data[5]];
|
|
382
|
+
}
|
|
383
|
+
// B(t) = p0 * (1-t)^3 + 3p1 * t * (1-t)^2 + 3p2 * t^2 * (1-t) + p3 * t^3
|
|
384
|
+
const equation = (t, idx) => Math.pow(1 - t, 3) * p3[idx] +
|
|
385
|
+
3 * t * Math.pow(1 - t, 2) * p2[idx] +
|
|
386
|
+
3 * Math.pow(t, 2) * (1 - t) * p1[idx] +
|
|
387
|
+
p0[idx] * Math.pow(t, 3);
|
|
388
|
+
// Ee know the last point of the arrow (or the first, if start arrowhead).
|
|
389
|
+
const [x2, y2] = position === "start" ? p0 : p3;
|
|
390
|
+
// By using cubic bezier equation (B(t)) and the given parameters,
|
|
391
|
+
// we calculate a point that is closer to the last point.
|
|
392
|
+
// The value 0.3 is chosen arbitrarily and it works best for all
|
|
393
|
+
// the tested cases.
|
|
394
|
+
const [x1, y1] = [equation(0.3, 0), equation(0.3, 1)];
|
|
395
|
+
// Find the normalized direction vector based on the
|
|
396
|
+
// previously calculated points.
|
|
397
|
+
const distance = Math.hypot(x2 - x1, y2 - y1);
|
|
398
|
+
const nx = (x2 - x1) / distance;
|
|
399
|
+
const ny = (y2 - y1) / distance;
|
|
400
|
+
const size = getArrowheadSize(arrowhead);
|
|
401
|
+
let length = 0;
|
|
402
|
+
{
|
|
403
|
+
// Length for -> arrows is based on the length of the last section
|
|
404
|
+
const [cx, cy] = position === "end"
|
|
405
|
+
? element.points[element.points.length - 1]
|
|
406
|
+
: element.points[0];
|
|
407
|
+
const [px, py] = element.points.length > 1
|
|
408
|
+
? position === "end"
|
|
409
|
+
? element.points[element.points.length - 2]
|
|
410
|
+
: element.points[1]
|
|
411
|
+
: [0, 0];
|
|
412
|
+
length = Math.hypot(cx - px, cy - py);
|
|
413
|
+
}
|
|
414
|
+
// Scale down the arrowhead until we hit a certain size so that it doesn't look weird.
|
|
415
|
+
// This value is selected by minimizing a minimum size with the last segment of the arrowhead
|
|
416
|
+
const lengthMultiplier = arrowhead === "diamond" || arrowhead === "diamond_outline" ? 0.25 : 0.5;
|
|
417
|
+
const minSize = Math.min(size, length * lengthMultiplier);
|
|
418
|
+
const xs = x2 - nx * minSize;
|
|
419
|
+
const ys = y2 - ny * minSize;
|
|
420
|
+
if (arrowhead === "dot" ||
|
|
421
|
+
arrowhead === "circle" ||
|
|
422
|
+
arrowhead === "circle_outline") {
|
|
423
|
+
const diameter = Math.hypot(ys - y2, xs - x2) + element.strokeWidth - 2;
|
|
424
|
+
return [x2, y2, diameter];
|
|
425
|
+
}
|
|
426
|
+
const angle = getArrowheadAngle(arrowhead);
|
|
427
|
+
// Return points
|
|
428
|
+
const [x3, y3] = rotate(xs, ys, x2, y2, (-angle * Math.PI) / 180);
|
|
429
|
+
const [x4, y4] = rotate(xs, ys, x2, y2, (angle * Math.PI) / 180);
|
|
430
|
+
if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
|
|
431
|
+
// point opposite to the arrowhead point
|
|
432
|
+
let ox;
|
|
433
|
+
let oy;
|
|
434
|
+
if (position === "start") {
|
|
435
|
+
const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
|
|
436
|
+
[ox, oy] = rotate(x2 + minSize * 2, y2, x2, y2, Math.atan2(py - y2, px - x2));
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
const [px, py] = element.points.length > 1
|
|
440
|
+
? element.points[element.points.length - 2]
|
|
441
|
+
: [0, 0];
|
|
442
|
+
[ox, oy] = rotate(x2 - minSize * 2, y2, x2, y2, Math.atan2(y2 - py, x2 - px));
|
|
443
|
+
}
|
|
444
|
+
return [x2, y2, x3, y3, ox, oy, x4, y4];
|
|
445
|
+
}
|
|
446
|
+
return [x2, y2, x3, y3, x4, y4];
|
|
447
|
+
};
|
|
448
|
+
const generateLinearElementShape = (element) => {
|
|
449
|
+
const generator = rough.generator();
|
|
450
|
+
const options = generateRoughOptions(element);
|
|
451
|
+
const method = (() => {
|
|
452
|
+
if (element.roundness) {
|
|
453
|
+
return "curve";
|
|
454
|
+
}
|
|
455
|
+
if (options.fill) {
|
|
456
|
+
return "polygon";
|
|
457
|
+
}
|
|
458
|
+
return "linearPath";
|
|
459
|
+
})();
|
|
460
|
+
return generator[method](element.points, options);
|
|
461
|
+
};
|
|
462
|
+
const getLinearElementRotatedBounds = (element, cx, cy) => {
|
|
463
|
+
if (element.points.length < 2) {
|
|
464
|
+
const [pointX, pointY] = element.points[0];
|
|
465
|
+
const [x, y] = rotate(element.x + pointX, element.y + pointY, cx, cy, element.angle);
|
|
466
|
+
let coords = [x, y, x, y];
|
|
467
|
+
const boundTextElement = getBoundTextElement(element);
|
|
468
|
+
if (boundTextElement) {
|
|
469
|
+
const coordsWithBoundText = LinearElementEditor.getMinMaxXYWithBoundText(element, [x, y, x, y], boundTextElement);
|
|
470
|
+
coords = [
|
|
471
|
+
coordsWithBoundText[0],
|
|
472
|
+
coordsWithBoundText[1],
|
|
473
|
+
coordsWithBoundText[2],
|
|
474
|
+
coordsWithBoundText[3],
|
|
475
|
+
];
|
|
476
|
+
}
|
|
477
|
+
return coords;
|
|
478
|
+
}
|
|
479
|
+
// first element is always the curve
|
|
480
|
+
const cachedShape = ShapeCache.get(element)?.[0];
|
|
481
|
+
const shape = cachedShape ?? generateLinearElementShape(element);
|
|
482
|
+
const ops = getCurvePathOps(shape);
|
|
483
|
+
const transformXY = (x, y) => rotate(element.x + x, element.y + y, cx, cy, element.angle);
|
|
484
|
+
const res = getMinMaxXYFromCurvePathOps(ops, transformXY);
|
|
485
|
+
let coords = [res[0], res[1], res[2], res[3]];
|
|
486
|
+
const boundTextElement = getBoundTextElement(element);
|
|
487
|
+
if (boundTextElement) {
|
|
488
|
+
const coordsWithBoundText = LinearElementEditor.getMinMaxXYWithBoundText(element, coords, boundTextElement);
|
|
489
|
+
coords = [
|
|
490
|
+
coordsWithBoundText[0],
|
|
491
|
+
coordsWithBoundText[1],
|
|
492
|
+
coordsWithBoundText[2],
|
|
493
|
+
coordsWithBoundText[3],
|
|
494
|
+
];
|
|
495
|
+
}
|
|
496
|
+
return coords;
|
|
497
|
+
};
|
|
498
|
+
export const getElementBounds = (element) => {
|
|
499
|
+
return ElementBounds.getBounds(element);
|
|
500
|
+
};
|
|
501
|
+
export const getCommonBounds = (elements) => {
|
|
502
|
+
if (!elements.length) {
|
|
503
|
+
return [0, 0, 0, 0];
|
|
504
|
+
}
|
|
505
|
+
let minX = Infinity;
|
|
506
|
+
let maxX = -Infinity;
|
|
507
|
+
let minY = Infinity;
|
|
508
|
+
let maxY = -Infinity;
|
|
509
|
+
elements.forEach((element) => {
|
|
510
|
+
const [x1, y1, x2, y2] = getElementBounds(element);
|
|
511
|
+
minX = Math.min(minX, x1);
|
|
512
|
+
minY = Math.min(minY, y1);
|
|
513
|
+
maxX = Math.max(maxX, x2);
|
|
514
|
+
maxY = Math.max(maxY, y2);
|
|
515
|
+
});
|
|
516
|
+
return [minX, minY, maxX, maxY];
|
|
517
|
+
};
|
|
518
|
+
export const getDraggedElementsBounds = (elements, dragOffset) => {
|
|
519
|
+
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
|
|
520
|
+
return [
|
|
521
|
+
minX + dragOffset.x,
|
|
522
|
+
minY + dragOffset.y,
|
|
523
|
+
maxX + dragOffset.x,
|
|
524
|
+
maxY + dragOffset.y,
|
|
525
|
+
];
|
|
526
|
+
};
|
|
527
|
+
export const getResizedElementAbsoluteCoords = (element, nextWidth, nextHeight, normalizePoints) => {
|
|
528
|
+
if (!(isLinearElement(element) || isFreeDrawElement(element))) {
|
|
529
|
+
return [
|
|
530
|
+
element.x,
|
|
531
|
+
element.y,
|
|
532
|
+
element.x + nextWidth,
|
|
533
|
+
element.y + nextHeight,
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
const points = rescalePoints(0, nextWidth, rescalePoints(1, nextHeight, element.points, normalizePoints), normalizePoints);
|
|
537
|
+
let bounds;
|
|
538
|
+
if (isFreeDrawElement(element)) {
|
|
539
|
+
// Free Draw
|
|
540
|
+
bounds = getBoundsFromPoints(points);
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
// Line
|
|
544
|
+
const gen = rough.generator();
|
|
545
|
+
const curve = !element.roundness
|
|
546
|
+
? gen.linearPath(points, generateRoughOptions(element))
|
|
547
|
+
: gen.curve(points, generateRoughOptions(element));
|
|
548
|
+
const ops = getCurvePathOps(curve);
|
|
549
|
+
bounds = getMinMaxXYFromCurvePathOps(ops);
|
|
550
|
+
}
|
|
551
|
+
const [minX, minY, maxX, maxY] = bounds;
|
|
552
|
+
return [
|
|
553
|
+
minX + element.x,
|
|
554
|
+
minY + element.y,
|
|
555
|
+
maxX + element.x,
|
|
556
|
+
maxY + element.y,
|
|
557
|
+
];
|
|
558
|
+
};
|
|
559
|
+
export const getElementPointsCoords = (element, points) => {
|
|
560
|
+
// This might be computationally heavey
|
|
561
|
+
const gen = rough.generator();
|
|
562
|
+
const curve = element.roundness == null
|
|
563
|
+
? gen.linearPath(points, generateRoughOptions(element))
|
|
564
|
+
: gen.curve(points, generateRoughOptions(element));
|
|
565
|
+
const ops = getCurvePathOps(curve);
|
|
566
|
+
const [minX, minY, maxX, maxY] = getMinMaxXYFromCurvePathOps(ops);
|
|
567
|
+
return [
|
|
568
|
+
minX + element.x,
|
|
569
|
+
minY + element.y,
|
|
570
|
+
maxX + element.x,
|
|
571
|
+
maxY + element.y,
|
|
572
|
+
];
|
|
573
|
+
};
|
|
574
|
+
export const getClosestElementBounds = (elements, from) => {
|
|
575
|
+
if (!elements.length) {
|
|
576
|
+
return [0, 0, 0, 0];
|
|
577
|
+
}
|
|
578
|
+
let minDistance = Infinity;
|
|
579
|
+
let closestElement = elements[0];
|
|
580
|
+
elements.forEach((element) => {
|
|
581
|
+
const [x1, y1, x2, y2] = getElementBounds(element);
|
|
582
|
+
const distance = distance2d((x1 + x2) / 2, (y1 + y2) / 2, from.x, from.y);
|
|
583
|
+
if (distance < minDistance) {
|
|
584
|
+
minDistance = distance;
|
|
585
|
+
closestElement = element;
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
return getElementBounds(closestElement);
|
|
589
|
+
};
|
|
590
|
+
export const getCommonBoundingBox = (elements) => {
|
|
591
|
+
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
|
|
592
|
+
return {
|
|
593
|
+
minX,
|
|
594
|
+
minY,
|
|
595
|
+
maxX,
|
|
596
|
+
maxY,
|
|
597
|
+
width: maxX - minX,
|
|
598
|
+
height: maxY - minY,
|
|
599
|
+
midX: (minX + maxX) / 2,
|
|
600
|
+
midY: (minY + maxY) / 2,
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* returns scene coords of user's editor viewport (visible canvas area) bounds
|
|
605
|
+
*/
|
|
606
|
+
export const getVisibleSceneBounds = ({ scrollX, scrollY, width, height, zoom, }) => {
|
|
607
|
+
return [
|
|
608
|
+
-scrollX,
|
|
609
|
+
-scrollY,
|
|
610
|
+
-scrollX + width / zoom.value,
|
|
611
|
+
-scrollY + height / zoom.value,
|
|
612
|
+
];
|
|
613
|
+
};
|