@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,304 @@
|
|
|
1
|
+
import rough from "roughjs/bin/rough";
|
|
2
|
+
import { getCommonBounds, getElementAbsoluteCoords, } from "../element/bounds";
|
|
3
|
+
import { renderSceneToSvg, renderStaticScene } from "../renderer/renderScene";
|
|
4
|
+
import { cloneJSON, distance, getFontString } from "../utils";
|
|
5
|
+
import { DEFAULT_EXPORT_PADDING, FONT_FAMILY, FRAME_STYLE, SVG_NS, THEME_FILTER, } from "../constants";
|
|
6
|
+
import { getDefaultAppState } from "../appState";
|
|
7
|
+
import { serializeAsJSON } from "../data/json";
|
|
8
|
+
import { getInitializedImageElements, updateImageCache, } from "../element/image";
|
|
9
|
+
import { elementsOverlappingBBox } from "../../utils/export";
|
|
10
|
+
import { getFrameLikeElements, getFrameLikeTitle, getRootElements, } from "../frame";
|
|
11
|
+
import { newTextElement } from "../element";
|
|
12
|
+
import { newElementWith } from "../element/mutateElement";
|
|
13
|
+
import Scene from "./Scene";
|
|
14
|
+
import { isFrameElement, isFrameLikeElement } from "../element/typeChecks";
|
|
15
|
+
const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
|
|
16
|
+
// getContainerElement and getBoundTextElement and potentially other helpers
|
|
17
|
+
// depend on `Scene` which will not be available when these pure utils are
|
|
18
|
+
// called outside initialized Excalidraw editor instance or even if called
|
|
19
|
+
// from inside Excalidraw if the elements were never cached by Scene (e.g.
|
|
20
|
+
// for library elements).
|
|
21
|
+
//
|
|
22
|
+
// As such, before passing the elements down, we need to initialize a custom
|
|
23
|
+
// Scene instance and assign them to it.
|
|
24
|
+
//
|
|
25
|
+
// FIXME This is a super hacky workaround and we'll need to rewrite this soon.
|
|
26
|
+
const __createSceneForElementsHack__ = (elements) => {
|
|
27
|
+
const scene = new Scene();
|
|
28
|
+
// we can't duplicate elements to regenerate ids because we need the
|
|
29
|
+
// orig ids when embedding. So we do another hack of not mapping element
|
|
30
|
+
// ids to Scene instances so that we don't override the editor elements
|
|
31
|
+
// mapping.
|
|
32
|
+
// We still need to clone the objects themselves to regen references.
|
|
33
|
+
scene.replaceAllElements(cloneJSON(elements), false);
|
|
34
|
+
return scene;
|
|
35
|
+
};
|
|
36
|
+
const truncateText = (element, maxWidth) => {
|
|
37
|
+
if (element.width <= maxWidth) {
|
|
38
|
+
return element;
|
|
39
|
+
}
|
|
40
|
+
const canvas = document.createElement("canvas");
|
|
41
|
+
const ctx = canvas.getContext("2d");
|
|
42
|
+
ctx.font = getFontString({
|
|
43
|
+
fontFamily: element.fontFamily,
|
|
44
|
+
fontSize: element.fontSize,
|
|
45
|
+
});
|
|
46
|
+
let text = element.text;
|
|
47
|
+
const metrics = ctx.measureText(text);
|
|
48
|
+
if (metrics.width > maxWidth) {
|
|
49
|
+
// we iterate from the right, removing characters one by one instead
|
|
50
|
+
// of bulding the string up. This assumes that it's more likely
|
|
51
|
+
// your frame names will overflow by not that many characters
|
|
52
|
+
// (if ever), so it sohuld be faster this way.
|
|
53
|
+
for (let i = text.length; i > 0; i--) {
|
|
54
|
+
const newText = `${text.slice(0, i)}...`;
|
|
55
|
+
if (ctx.measureText(newText).width <= maxWidth) {
|
|
56
|
+
text = newText;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return newElementWith(element, { text, width: maxWidth });
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* When exporting frames, we need to render frame labels which are currently
|
|
65
|
+
* being rendered in DOM when editing. Adding the labels as regular text
|
|
66
|
+
* elements seems like a simple hack. In the future we'll want to move to
|
|
67
|
+
* proper canvas rendering, even within editor (instead of DOM).
|
|
68
|
+
*/
|
|
69
|
+
const addFrameLabelsAsTextElements = (elements, opts) => {
|
|
70
|
+
const nextElements = [];
|
|
71
|
+
let frameIndex = 0;
|
|
72
|
+
let magicFrameIndex = 0;
|
|
73
|
+
for (const element of elements) {
|
|
74
|
+
if (isFrameLikeElement(element)) {
|
|
75
|
+
if (isFrameElement(element)) {
|
|
76
|
+
frameIndex++;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
magicFrameIndex++;
|
|
80
|
+
}
|
|
81
|
+
let textElement = newTextElement({
|
|
82
|
+
x: element.x,
|
|
83
|
+
y: element.y - FRAME_STYLE.nameOffsetY,
|
|
84
|
+
fontFamily: FONT_FAMILY.Assistant,
|
|
85
|
+
fontSize: FRAME_STYLE.nameFontSize,
|
|
86
|
+
lineHeight: FRAME_STYLE.nameLineHeight,
|
|
87
|
+
strokeColor: opts.exportWithDarkMode
|
|
88
|
+
? FRAME_STYLE.nameColorDarkTheme
|
|
89
|
+
: FRAME_STYLE.nameColorLightTheme,
|
|
90
|
+
text: getFrameLikeTitle(element, isFrameElement(element) ? frameIndex : magicFrameIndex),
|
|
91
|
+
});
|
|
92
|
+
textElement.y -= textElement.height;
|
|
93
|
+
textElement = truncateText(textElement, element.width);
|
|
94
|
+
nextElements.push(textElement);
|
|
95
|
+
}
|
|
96
|
+
nextElements.push(element);
|
|
97
|
+
}
|
|
98
|
+
return nextElements;
|
|
99
|
+
};
|
|
100
|
+
const getFrameRenderingConfig = (exportingFrame, frameRendering) => {
|
|
101
|
+
frameRendering = frameRendering || getDefaultAppState().frameRendering;
|
|
102
|
+
return {
|
|
103
|
+
enabled: exportingFrame ? true : frameRendering.enabled,
|
|
104
|
+
outline: exportingFrame ? false : frameRendering.outline,
|
|
105
|
+
name: exportingFrame ? false : frameRendering.name,
|
|
106
|
+
clip: exportingFrame ? true : frameRendering.clip,
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const prepareElementsForRender = ({ elements, exportingFrame, frameRendering, exportWithDarkMode, }) => {
|
|
110
|
+
let nextElements;
|
|
111
|
+
if (exportingFrame) {
|
|
112
|
+
nextElements = elementsOverlappingBBox({
|
|
113
|
+
elements,
|
|
114
|
+
bounds: exportingFrame,
|
|
115
|
+
type: "overlap",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else if (frameRendering.enabled && frameRendering.name) {
|
|
119
|
+
nextElements = addFrameLabelsAsTextElements(elements, {
|
|
120
|
+
exportWithDarkMode,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
nextElements = elements;
|
|
125
|
+
}
|
|
126
|
+
return nextElements;
|
|
127
|
+
};
|
|
128
|
+
export const exportToCanvas = async (elements, appState, files, { exportBackground, exportPadding = DEFAULT_EXPORT_PADDING, viewBackgroundColor, exportingFrame, }, createCanvas = (width, height) => {
|
|
129
|
+
const canvas = document.createElement("canvas");
|
|
130
|
+
canvas.width = width * appState.exportScale;
|
|
131
|
+
canvas.height = height * appState.exportScale;
|
|
132
|
+
return { canvas, scale: appState.exportScale };
|
|
133
|
+
}) => {
|
|
134
|
+
const tempScene = __createSceneForElementsHack__(elements);
|
|
135
|
+
elements = tempScene.getNonDeletedElements();
|
|
136
|
+
const frameRendering = getFrameRenderingConfig(exportingFrame ?? null, appState.frameRendering ?? null);
|
|
137
|
+
const elementsForRender = prepareElementsForRender({
|
|
138
|
+
elements,
|
|
139
|
+
exportingFrame,
|
|
140
|
+
exportWithDarkMode: appState.exportWithDarkMode,
|
|
141
|
+
frameRendering,
|
|
142
|
+
});
|
|
143
|
+
if (exportingFrame) {
|
|
144
|
+
exportPadding = 0;
|
|
145
|
+
}
|
|
146
|
+
const [minX, minY, width, height] = getCanvasSize(exportingFrame ? [exportingFrame] : getRootElements(elementsForRender), exportPadding);
|
|
147
|
+
const { canvas, scale = 1 } = createCanvas(width, height);
|
|
148
|
+
const defaultAppState = getDefaultAppState();
|
|
149
|
+
const { imageCache } = await updateImageCache({
|
|
150
|
+
imageCache: new Map(),
|
|
151
|
+
fileIds: getInitializedImageElements(elementsForRender).map((element) => element.fileId),
|
|
152
|
+
files,
|
|
153
|
+
});
|
|
154
|
+
renderStaticScene({
|
|
155
|
+
canvas,
|
|
156
|
+
rc: rough.canvas(canvas),
|
|
157
|
+
elements: elementsForRender,
|
|
158
|
+
visibleElements: elementsForRender,
|
|
159
|
+
scale,
|
|
160
|
+
appState: {
|
|
161
|
+
...appState,
|
|
162
|
+
frameRendering,
|
|
163
|
+
viewBackgroundColor: exportBackground ? viewBackgroundColor : null,
|
|
164
|
+
scrollX: -minX + exportPadding,
|
|
165
|
+
scrollY: -minY + exportPadding,
|
|
166
|
+
zoom: defaultAppState.zoom,
|
|
167
|
+
shouldCacheIgnoreZoom: false,
|
|
168
|
+
theme: appState.exportWithDarkMode ? "dark" : "light",
|
|
169
|
+
},
|
|
170
|
+
renderConfig: {
|
|
171
|
+
canvasBackgroundColor: viewBackgroundColor,
|
|
172
|
+
imageCache,
|
|
173
|
+
renderGrid: false,
|
|
174
|
+
isExporting: true,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
tempScene.destroy();
|
|
178
|
+
return canvas;
|
|
179
|
+
};
|
|
180
|
+
export const exportToSvg = async (elements, appState, files, opts) => {
|
|
181
|
+
const tempScene = __createSceneForElementsHack__(elements);
|
|
182
|
+
elements = tempScene.getNonDeletedElements();
|
|
183
|
+
const frameRendering = getFrameRenderingConfig(opts?.exportingFrame ?? null, appState.frameRendering ?? null);
|
|
184
|
+
let { exportPadding = DEFAULT_EXPORT_PADDING, exportWithDarkMode = false, viewBackgroundColor, exportScale = 1, exportEmbedScene, } = appState;
|
|
185
|
+
const { exportingFrame = null } = opts || {};
|
|
186
|
+
const elementsForRender = prepareElementsForRender({
|
|
187
|
+
elements,
|
|
188
|
+
exportingFrame,
|
|
189
|
+
exportWithDarkMode,
|
|
190
|
+
frameRendering,
|
|
191
|
+
});
|
|
192
|
+
if (exportingFrame) {
|
|
193
|
+
exportPadding = 0;
|
|
194
|
+
}
|
|
195
|
+
let metadata = "";
|
|
196
|
+
// we need to serialize the "original" elements before we put them through
|
|
197
|
+
// the tempScene hack which duplicates and regenerates ids
|
|
198
|
+
if (exportEmbedScene) {
|
|
199
|
+
try {
|
|
200
|
+
metadata = await (await import("../data/image")).encodeSvgMetadata({
|
|
201
|
+
// when embedding scene, we want to embed the origionally supplied
|
|
202
|
+
// elements which don't contain the temp frame labels.
|
|
203
|
+
// But it also requires that the exportToSvg is being supplied with
|
|
204
|
+
// only the elements that we're exporting, and no extra.
|
|
205
|
+
text: serializeAsJSON(elements, appState, files || {}, "local"),
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.error(error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const [minX, minY, width, height] = getCanvasSize(exportingFrame ? [exportingFrame] : getRootElements(elementsForRender), exportPadding);
|
|
213
|
+
// initialize SVG root
|
|
214
|
+
const svgRoot = document.createElementNS(SVG_NS, "svg");
|
|
215
|
+
svgRoot.setAttribute("version", "1.1");
|
|
216
|
+
svgRoot.setAttribute("xmlns", SVG_NS);
|
|
217
|
+
svgRoot.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
218
|
+
svgRoot.setAttribute("width", `${width * exportScale}`);
|
|
219
|
+
svgRoot.setAttribute("height", `${height * exportScale}`);
|
|
220
|
+
if (exportWithDarkMode) {
|
|
221
|
+
svgRoot.setAttribute("filter", THEME_FILTER);
|
|
222
|
+
}
|
|
223
|
+
let assetPath = "https://excalidraw.com/";
|
|
224
|
+
// Asset path needs to be determined only when using package
|
|
225
|
+
if (import.meta.env.VITE_IS_EXCALIDRAW_NPM_PACKAGE) {
|
|
226
|
+
assetPath =
|
|
227
|
+
window.EXCALIDRAW_ASSET_PATH ||
|
|
228
|
+
`https://unpkg.com/${import.meta.env.VITE_PKG_NAME}@${import.meta.env.PKG_VERSION}`;
|
|
229
|
+
if (assetPath?.startsWith("/")) {
|
|
230
|
+
assetPath = assetPath.replace("/", `${window.location.origin}/`);
|
|
231
|
+
}
|
|
232
|
+
assetPath = `${assetPath}/dist/excalidraw-assets/`;
|
|
233
|
+
}
|
|
234
|
+
const offsetX = -minX + exportPadding;
|
|
235
|
+
const offsetY = -minY + exportPadding;
|
|
236
|
+
const frameElements = getFrameLikeElements(elements);
|
|
237
|
+
let exportingFrameClipPath = "";
|
|
238
|
+
for (const frame of frameElements) {
|
|
239
|
+
const [x1, y1, x2, y2] = getElementAbsoluteCoords(frame);
|
|
240
|
+
const cx = (x2 - x1) / 2 - (frame.x - x1);
|
|
241
|
+
const cy = (y2 - y1) / 2 - (frame.y - y1);
|
|
242
|
+
exportingFrameClipPath += `<clipPath id=${frame.id}>
|
|
243
|
+
<rect transform="translate(${frame.x + offsetX} ${frame.y + offsetY}) rotate(${frame.angle} ${cx} ${cy})"
|
|
244
|
+
width="${frame.width}"
|
|
245
|
+
height="${frame.height}"
|
|
246
|
+
>
|
|
247
|
+
</rect>
|
|
248
|
+
</clipPath>`;
|
|
249
|
+
}
|
|
250
|
+
svgRoot.innerHTML = `
|
|
251
|
+
${SVG_EXPORT_TAG}
|
|
252
|
+
${metadata}
|
|
253
|
+
<defs>
|
|
254
|
+
<style class="style-fonts">
|
|
255
|
+
@font-face {
|
|
256
|
+
font-family: "Virgil";
|
|
257
|
+
src: url("${assetPath}Virgil.woff2");
|
|
258
|
+
}
|
|
259
|
+
@font-face {
|
|
260
|
+
font-family: "Cascadia";
|
|
261
|
+
src: url("${assetPath}Cascadia.woff2");
|
|
262
|
+
}
|
|
263
|
+
@font-face {
|
|
264
|
+
font-family: "Assistant";
|
|
265
|
+
src: url("${assetPath}Assistant-Regular.woff2");
|
|
266
|
+
}
|
|
267
|
+
</style>
|
|
268
|
+
${exportingFrameClipPath}
|
|
269
|
+
</defs>
|
|
270
|
+
`;
|
|
271
|
+
// render background rect
|
|
272
|
+
if (appState.exportBackground && viewBackgroundColor) {
|
|
273
|
+
const rect = svgRoot.ownerDocument.createElementNS(SVG_NS, "rect");
|
|
274
|
+
rect.setAttribute("x", "0");
|
|
275
|
+
rect.setAttribute("y", "0");
|
|
276
|
+
rect.setAttribute("width", `${width}`);
|
|
277
|
+
rect.setAttribute("height", `${height}`);
|
|
278
|
+
rect.setAttribute("fill", viewBackgroundColor);
|
|
279
|
+
svgRoot.appendChild(rect);
|
|
280
|
+
}
|
|
281
|
+
const rsvg = rough.svg(svgRoot);
|
|
282
|
+
renderSceneToSvg(elementsForRender, rsvg, svgRoot, files || {}, {
|
|
283
|
+
offsetX,
|
|
284
|
+
offsetY,
|
|
285
|
+
isExporting: true,
|
|
286
|
+
exportWithDarkMode,
|
|
287
|
+
renderEmbeddables: opts?.renderEmbeddables ?? false,
|
|
288
|
+
frameRendering,
|
|
289
|
+
canvasBackgroundColor: viewBackgroundColor,
|
|
290
|
+
});
|
|
291
|
+
tempScene.destroy();
|
|
292
|
+
return svgRoot;
|
|
293
|
+
};
|
|
294
|
+
// calculate smallest area to fit the contents in
|
|
295
|
+
const getCanvasSize = (elements, exportPadding) => {
|
|
296
|
+
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
|
|
297
|
+
const width = distance(minX, maxX) + exportPadding * 2;
|
|
298
|
+
const height = distance(minY, maxY) + exportPadding * 2;
|
|
299
|
+
return [minX, minY, width, height];
|
|
300
|
+
};
|
|
301
|
+
export const getExportSize = (elements, exportPadding, scale) => {
|
|
302
|
+
const [, , width, height] = getCanvasSize(elements, exportPadding).map((dimension) => Math.trunc(dimension * scale));
|
|
303
|
+
return [width, height];
|
|
304
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { isOverScrollBars } from "./scrollbars";
|
|
2
|
+
export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
|
|
3
|
+
export { calculateScrollCenter } from "./scroll";
|
|
4
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, getElementAtPosition, getElementsAtPosition, } from "./comparisons";
|
|
5
|
+
export { getNormalizedZoom } from "./zoom";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getCommonBounds, getClosestElementBounds, getVisibleElements, } from "../element";
|
|
2
|
+
import { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "../utils";
|
|
3
|
+
const isOutsideViewPort = (appState, cords) => {
|
|
4
|
+
const [x1, y1, x2, y2] = cords;
|
|
5
|
+
const { x: viewportX1, y: viewportY1 } = sceneCoordsToViewportCoords({ sceneX: x1, sceneY: y1 }, appState);
|
|
6
|
+
const { x: viewportX2, y: viewportY2 } = sceneCoordsToViewportCoords({ sceneX: x2, sceneY: y2 }, appState);
|
|
7
|
+
return (viewportX2 - viewportX1 > appState.width ||
|
|
8
|
+
viewportY2 - viewportY1 > appState.height);
|
|
9
|
+
};
|
|
10
|
+
export const centerScrollOn = ({ scenePoint, viewportDimensions, zoom, }) => {
|
|
11
|
+
return {
|
|
12
|
+
scrollX: viewportDimensions.width / 2 / zoom.value - scenePoint.x,
|
|
13
|
+
scrollY: viewportDimensions.height / 2 / zoom.value - scenePoint.y,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const calculateScrollCenter = (elements, appState) => {
|
|
17
|
+
elements = getVisibleElements(elements);
|
|
18
|
+
if (!elements.length) {
|
|
19
|
+
return {
|
|
20
|
+
scrollX: 0,
|
|
21
|
+
scrollY: 0,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
let [x1, y1, x2, y2] = getCommonBounds(elements);
|
|
25
|
+
if (isOutsideViewPort(appState, [x1, y1, x2, y2])) {
|
|
26
|
+
[x1, y1, x2, y2] = getClosestElementBounds(elements, viewportCoordsToSceneCoords({ clientX: appState.scrollX, clientY: appState.scrollY }, appState));
|
|
27
|
+
}
|
|
28
|
+
const centerX = (x1 + x2) / 2;
|
|
29
|
+
const centerY = (y1 + y2) / 2;
|
|
30
|
+
return centerScrollOn({
|
|
31
|
+
scenePoint: { x: centerX, y: centerY },
|
|
32
|
+
viewportDimensions: { width: appState.width, height: appState.height },
|
|
33
|
+
zoom: appState.zoom,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { getCommonBounds } from "../element";
|
|
2
|
+
import { getGlobalCSSVariable } from "../utils";
|
|
3
|
+
import { getLanguage } from "../i18n";
|
|
4
|
+
export const SCROLLBAR_MARGIN = 4;
|
|
5
|
+
export const SCROLLBAR_WIDTH = 6;
|
|
6
|
+
export const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
|
|
7
|
+
export const getScrollBars = (elements, viewportWidth, viewportHeight, appState) => {
|
|
8
|
+
if (elements.length === 0) {
|
|
9
|
+
return {
|
|
10
|
+
horizontal: null,
|
|
11
|
+
vertical: null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
// This is the bounding box of all the elements
|
|
15
|
+
const [elementsMinX, elementsMinY, elementsMaxX, elementsMaxY] = getCommonBounds(elements);
|
|
16
|
+
// Apply zoom
|
|
17
|
+
const viewportWidthWithZoom = viewportWidth / appState.zoom.value;
|
|
18
|
+
const viewportHeightWithZoom = viewportHeight / appState.zoom.value;
|
|
19
|
+
const viewportWidthDiff = viewportWidth - viewportWidthWithZoom;
|
|
20
|
+
const viewportHeightDiff = viewportHeight - viewportHeightWithZoom;
|
|
21
|
+
const safeArea = {
|
|
22
|
+
top: parseInt(getGlobalCSSVariable("sat")) || 0,
|
|
23
|
+
bottom: parseInt(getGlobalCSSVariable("sab")) || 0,
|
|
24
|
+
left: parseInt(getGlobalCSSVariable("sal")) || 0,
|
|
25
|
+
right: parseInt(getGlobalCSSVariable("sar")) || 0,
|
|
26
|
+
};
|
|
27
|
+
const isRTL = getLanguage().rtl;
|
|
28
|
+
// The viewport is the rectangle currently visible for the user
|
|
29
|
+
const viewportMinX = -appState.scrollX + viewportWidthDiff / 2 + safeArea.left;
|
|
30
|
+
const viewportMinY = -appState.scrollY + viewportHeightDiff / 2 + safeArea.top;
|
|
31
|
+
const viewportMaxX = viewportMinX + viewportWidthWithZoom - safeArea.right;
|
|
32
|
+
const viewportMaxY = viewportMinY + viewportHeightWithZoom - safeArea.bottom;
|
|
33
|
+
// The scene is the bounding box of both the elements and viewport
|
|
34
|
+
const sceneMinX = Math.min(elementsMinX, viewportMinX);
|
|
35
|
+
const sceneMinY = Math.min(elementsMinY, viewportMinY);
|
|
36
|
+
const sceneMaxX = Math.max(elementsMaxX, viewportMaxX);
|
|
37
|
+
const sceneMaxY = Math.max(elementsMaxY, viewportMaxY);
|
|
38
|
+
// The scrollbar represents where the viewport is in relationship to the scene
|
|
39
|
+
return {
|
|
40
|
+
horizontal: viewportMinX === sceneMinX && viewportMaxX === sceneMaxX
|
|
41
|
+
? null
|
|
42
|
+
: {
|
|
43
|
+
x: Math.max(safeArea.left, SCROLLBAR_MARGIN) +
|
|
44
|
+
((viewportMinX - sceneMinX) / (sceneMaxX - sceneMinX)) *
|
|
45
|
+
viewportWidth,
|
|
46
|
+
y: viewportHeight -
|
|
47
|
+
SCROLLBAR_WIDTH -
|
|
48
|
+
Math.max(SCROLLBAR_MARGIN, safeArea.bottom),
|
|
49
|
+
width: ((viewportMaxX - viewportMinX) / (sceneMaxX - sceneMinX)) *
|
|
50
|
+
viewportWidth -
|
|
51
|
+
Math.max(SCROLLBAR_MARGIN * 2, safeArea.left + safeArea.right),
|
|
52
|
+
height: SCROLLBAR_WIDTH,
|
|
53
|
+
},
|
|
54
|
+
vertical: viewportMinY === sceneMinY && viewportMaxY === sceneMaxY
|
|
55
|
+
? null
|
|
56
|
+
: {
|
|
57
|
+
x: isRTL
|
|
58
|
+
? Math.max(safeArea.left, SCROLLBAR_MARGIN)
|
|
59
|
+
: viewportWidth -
|
|
60
|
+
SCROLLBAR_WIDTH -
|
|
61
|
+
Math.max(safeArea.right, SCROLLBAR_MARGIN),
|
|
62
|
+
y: ((viewportMinY - sceneMinY) / (sceneMaxY - sceneMinY)) *
|
|
63
|
+
viewportHeight +
|
|
64
|
+
Math.max(safeArea.top, SCROLLBAR_MARGIN),
|
|
65
|
+
width: SCROLLBAR_WIDTH,
|
|
66
|
+
height: ((viewportMaxY - viewportMinY) / (sceneMaxY - sceneMinY)) *
|
|
67
|
+
viewportHeight -
|
|
68
|
+
Math.max(SCROLLBAR_MARGIN * 2, safeArea.top + safeArea.bottom),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export const isOverScrollBars = (scrollBars, x, y) => {
|
|
73
|
+
const [isOverHorizontal, isOverVertical] = [
|
|
74
|
+
scrollBars.horizontal,
|
|
75
|
+
scrollBars.vertical,
|
|
76
|
+
].map((scrollBar) => {
|
|
77
|
+
return (scrollBar != null &&
|
|
78
|
+
scrollBar.x <= x &&
|
|
79
|
+
x <= scrollBar.x + scrollBar.width &&
|
|
80
|
+
scrollBar.y <= y &&
|
|
81
|
+
y <= scrollBar.y + scrollBar.height);
|
|
82
|
+
});
|
|
83
|
+
const isOverEither = isOverHorizontal || isOverVertical;
|
|
84
|
+
return { isOverEither, isOverHorizontal, isOverVertical };
|
|
85
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getElementAbsoluteCoords, getElementBounds } from "../element";
|
|
2
|
+
import { isBoundToContainer, isFrameLikeElement } from "../element/typeChecks";
|
|
3
|
+
import { elementOverlapsWithFrame, getContainingFrame, getFrameChildren, } from "../frame";
|
|
4
|
+
import { isShallowEqual } from "../utils";
|
|
5
|
+
import { isElementInViewport } from "../element/sizeHelpers";
|
|
6
|
+
/**
|
|
7
|
+
* Frames and their containing elements are not to be selected at the same time.
|
|
8
|
+
* Given an array of selected elements, if there are frames and their containing elements
|
|
9
|
+
* we only keep the frames.
|
|
10
|
+
* @param selectedElements
|
|
11
|
+
*/
|
|
12
|
+
export const excludeElementsInFramesFromSelection = (selectedElements) => {
|
|
13
|
+
const framesInSelection = new Set();
|
|
14
|
+
selectedElements.forEach((element) => {
|
|
15
|
+
if (isFrameLikeElement(element)) {
|
|
16
|
+
framesInSelection.add(element.id);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return selectedElements.filter((element) => {
|
|
20
|
+
if (element.frameId && framesInSelection.has(element.frameId)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export const getElementsWithinSelection = (elements, selection, excludeElementsInFrames = true) => {
|
|
27
|
+
const [selectionX1, selectionY1, selectionX2, selectionY2] = getElementAbsoluteCoords(selection);
|
|
28
|
+
let elementsInSelection = elements.filter((element) => {
|
|
29
|
+
let [elementX1, elementY1, elementX2, elementY2] = getElementBounds(element);
|
|
30
|
+
const containingFrame = getContainingFrame(element);
|
|
31
|
+
if (containingFrame) {
|
|
32
|
+
const [fx1, fy1, fx2, fy2] = getElementBounds(containingFrame);
|
|
33
|
+
elementX1 = Math.max(fx1, elementX1);
|
|
34
|
+
elementY1 = Math.max(fy1, elementY1);
|
|
35
|
+
elementX2 = Math.min(fx2, elementX2);
|
|
36
|
+
elementY2 = Math.min(fy2, elementY2);
|
|
37
|
+
}
|
|
38
|
+
return (element.locked === false &&
|
|
39
|
+
element.type !== "selection" &&
|
|
40
|
+
!isBoundToContainer(element) &&
|
|
41
|
+
selectionX1 <= elementX1 &&
|
|
42
|
+
selectionY1 <= elementY1 &&
|
|
43
|
+
selectionX2 >= elementX2 &&
|
|
44
|
+
selectionY2 >= elementY2);
|
|
45
|
+
});
|
|
46
|
+
elementsInSelection = excludeElementsInFrames
|
|
47
|
+
? excludeElementsInFramesFromSelection(elementsInSelection)
|
|
48
|
+
: elementsInSelection;
|
|
49
|
+
elementsInSelection = elementsInSelection.filter((element) => {
|
|
50
|
+
const containingFrame = getContainingFrame(element);
|
|
51
|
+
if (containingFrame) {
|
|
52
|
+
return elementOverlapsWithFrame(element, containingFrame);
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
return elementsInSelection;
|
|
57
|
+
};
|
|
58
|
+
export const getVisibleAndNonSelectedElements = (elements, selectedElements, appState) => {
|
|
59
|
+
const selectedElementsSet = new Set(selectedElements.map((element) => element.id));
|
|
60
|
+
return elements.filter((element) => {
|
|
61
|
+
const isVisible = isElementInViewport(element, appState.width, appState.height, appState);
|
|
62
|
+
return !selectedElementsSet.has(element.id) && isVisible;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
// FIXME move this into the editor instance to keep utility methods stateless
|
|
66
|
+
export const isSomeElementSelected = (function () {
|
|
67
|
+
let lastElements = null;
|
|
68
|
+
let lastSelectedElementIds = null;
|
|
69
|
+
let isSelected = null;
|
|
70
|
+
const ret = (elements, appState) => {
|
|
71
|
+
if (isSelected != null &&
|
|
72
|
+
elements === lastElements &&
|
|
73
|
+
appState.selectedElementIds === lastSelectedElementIds) {
|
|
74
|
+
return isSelected;
|
|
75
|
+
}
|
|
76
|
+
isSelected = elements.some((element) => appState.selectedElementIds[element.id]);
|
|
77
|
+
lastElements = elements;
|
|
78
|
+
lastSelectedElementIds = appState.selectedElementIds;
|
|
79
|
+
return isSelected;
|
|
80
|
+
};
|
|
81
|
+
ret.clearCache = () => {
|
|
82
|
+
lastElements = null;
|
|
83
|
+
lastSelectedElementIds = null;
|
|
84
|
+
isSelected = null;
|
|
85
|
+
};
|
|
86
|
+
return ret;
|
|
87
|
+
})();
|
|
88
|
+
/**
|
|
89
|
+
* Returns common attribute (picked by `getAttribute` callback) of selected
|
|
90
|
+
* elements. If elements don't share the same value, returns `null`.
|
|
91
|
+
*/
|
|
92
|
+
export const getCommonAttributeOfSelectedElements = (elements, appState, getAttribute) => {
|
|
93
|
+
const attributes = Array.from(new Set(getSelectedElements(elements, appState).map((element) => getAttribute(element))));
|
|
94
|
+
return attributes.length === 1 ? attributes[0] : null;
|
|
95
|
+
};
|
|
96
|
+
export const getSelectedElements = (elements, appState, opts) => {
|
|
97
|
+
const selectedElements = elements.filter((element) => {
|
|
98
|
+
if (appState.selectedElementIds[element.id]) {
|
|
99
|
+
return element;
|
|
100
|
+
}
|
|
101
|
+
if (opts?.includeBoundTextElement &&
|
|
102
|
+
isBoundToContainer(element) &&
|
|
103
|
+
appState.selectedElementIds[element?.containerId]) {
|
|
104
|
+
return element;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
});
|
|
108
|
+
if (opts?.includeElementsInFrames) {
|
|
109
|
+
const elementsToInclude = [];
|
|
110
|
+
selectedElements.forEach((element) => {
|
|
111
|
+
if (isFrameLikeElement(element)) {
|
|
112
|
+
getFrameChildren(elements, element.id).forEach((e) => elementsToInclude.push(e));
|
|
113
|
+
}
|
|
114
|
+
elementsToInclude.push(element);
|
|
115
|
+
});
|
|
116
|
+
return elementsToInclude;
|
|
117
|
+
}
|
|
118
|
+
return selectedElements;
|
|
119
|
+
};
|
|
120
|
+
export const getTargetElements = (elements, appState) => appState.editingElement
|
|
121
|
+
? [appState.editingElement]
|
|
122
|
+
: getSelectedElements(elements, appState, {
|
|
123
|
+
includeBoundTextElement: true,
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* returns prevState's selectedElementids if no change from previous, so as to
|
|
127
|
+
* retain reference identity for memoization
|
|
128
|
+
*/
|
|
129
|
+
export const makeNextSelectedElementIds = (nextSelectedElementIds, prevState) => {
|
|
130
|
+
if (isShallowEqual(prevState.selectedElementIds, nextSelectedElementIds)) {
|
|
131
|
+
return prevState.selectedElementIds;
|
|
132
|
+
}
|
|
133
|
+
return nextSelectedElementIds;
|
|
134
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MIN_ZOOM } from "../constants";
|
|
2
|
+
export const getNormalizedZoom = (zoom) => {
|
|
3
|
+
return Math.max(MIN_ZOOM, Math.min(zoom, 30));
|
|
4
|
+
};
|
|
5
|
+
export const getStateForZoom = ({ viewportX, viewportY, nextZoom, }, appState) => {
|
|
6
|
+
const appLayerX = viewportX - appState.offsetLeft;
|
|
7
|
+
const appLayerY = viewportY - appState.offsetTop;
|
|
8
|
+
const currentZoom = appState.zoom.value;
|
|
9
|
+
// get original scroll position without zoom
|
|
10
|
+
const baseScrollX = appState.scrollX + (appLayerX - appLayerX / currentZoom);
|
|
11
|
+
const baseScrollY = appState.scrollY + (appLayerY - appLayerY / currentZoom);
|
|
12
|
+
// get scroll offsets for target zoom level
|
|
13
|
+
const zoomOffsetScrollX = -(appLayerX - appLayerX / nextZoom);
|
|
14
|
+
const zoomOffsetScrollY = -(appLayerY - appLayerY / nextZoom);
|
|
15
|
+
return {
|
|
16
|
+
scrollX: baseScrollX + zoomOffsetScrollX,
|
|
17
|
+
scrollY: baseScrollY + zoomOffsetScrollY,
|
|
18
|
+
zoom: {
|
|
19
|
+
value: nextZoom,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ArrowIcon, DiamondIcon, EllipseIcon, EraserIcon, FreedrawIcon, ImageIcon, LineIcon, RectangleIcon, SelectionIcon, TextIcon, } from "./components/icons";
|
|
2
|
+
import { KEYS } from "./keys";
|
|
3
|
+
export const SHAPES = [
|
|
4
|
+
{
|
|
5
|
+
icon: SelectionIcon,
|
|
6
|
+
value: "selection",
|
|
7
|
+
key: KEYS.V,
|
|
8
|
+
numericKey: KEYS["1"],
|
|
9
|
+
fillable: true,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
icon: RectangleIcon,
|
|
13
|
+
value: "rectangle",
|
|
14
|
+
key: KEYS.R,
|
|
15
|
+
numericKey: KEYS["2"],
|
|
16
|
+
fillable: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
icon: DiamondIcon,
|
|
20
|
+
value: "diamond",
|
|
21
|
+
key: KEYS.D,
|
|
22
|
+
numericKey: KEYS["3"],
|
|
23
|
+
fillable: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
icon: EllipseIcon,
|
|
27
|
+
value: "ellipse",
|
|
28
|
+
key: KEYS.O,
|
|
29
|
+
numericKey: KEYS["4"],
|
|
30
|
+
fillable: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: ArrowIcon,
|
|
34
|
+
value: "arrow",
|
|
35
|
+
key: KEYS.A,
|
|
36
|
+
numericKey: KEYS["5"],
|
|
37
|
+
fillable: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
icon: LineIcon,
|
|
41
|
+
value: "line",
|
|
42
|
+
key: KEYS.L,
|
|
43
|
+
numericKey: KEYS["6"],
|
|
44
|
+
fillable: true,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
icon: FreedrawIcon,
|
|
48
|
+
value: "freedraw",
|
|
49
|
+
key: [KEYS.P, KEYS.X],
|
|
50
|
+
numericKey: KEYS["7"],
|
|
51
|
+
fillable: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
icon: TextIcon,
|
|
55
|
+
value: "text",
|
|
56
|
+
key: KEYS.T,
|
|
57
|
+
numericKey: KEYS["8"],
|
|
58
|
+
fillable: false,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
icon: ImageIcon,
|
|
62
|
+
value: "image",
|
|
63
|
+
key: null,
|
|
64
|
+
numericKey: KEYS["9"],
|
|
65
|
+
fillable: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
icon: EraserIcon,
|
|
69
|
+
value: "eraser",
|
|
70
|
+
key: KEYS.E,
|
|
71
|
+
numericKey: KEYS["0"],
|
|
72
|
+
fillable: false,
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
export const findShapeByKey = (key) => {
|
|
76
|
+
const shape = SHAPES.find((shape, index) => {
|
|
77
|
+
return ((shape.numericKey != null && key === shape.numericKey.toString()) ||
|
|
78
|
+
(shape.key &&
|
|
79
|
+
(typeof shape.key === "string"
|
|
80
|
+
? shape.key === key
|
|
81
|
+
: shape.key.includes(key))));
|
|
82
|
+
});
|
|
83
|
+
return shape?.value || null;
|
|
84
|
+
};
|