@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,859 @@
|
|
|
1
|
+
import oc from "open-color";
|
|
2
|
+
import { getElementAbsoluteCoords, OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, getCommonBounds, } from "../element";
|
|
3
|
+
import { roundRect } from "./roundRect";
|
|
4
|
+
import { getScrollBars, SCROLLBAR_COLOR, SCROLLBAR_WIDTH, } from "../scene/scrollbars";
|
|
5
|
+
import { renderElement, renderElementToSvg, renderSelectionElement, } from "./renderElement";
|
|
6
|
+
import { getClientColor } from "../clients";
|
|
7
|
+
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
8
|
+
import { isSelectedViaGroup, getSelectedGroupIds, getElementsInGroup, selectGroupsFromGivenElements, } from "../groups";
|
|
9
|
+
import { maxBindingGap } from "../element/collision";
|
|
10
|
+
import { OMIT_SIDES_FOR_FRAME, shouldShowBoundingBox, } from "../element/transformHandles";
|
|
11
|
+
import { throttleRAF } from "../utils";
|
|
12
|
+
import { UserIdleState } from "../types";
|
|
13
|
+
import { FRAME_STYLE, THEME_FILTER } from "../constants";
|
|
14
|
+
import { EXTERNAL_LINK_IMG, getLinkHandleFromCoords, } from "../element/Hyperlink";
|
|
15
|
+
import { renderSnaps } from "./renderSnaps";
|
|
16
|
+
import { isEmbeddableElement, isFrameLikeElement, isIframeLikeElement, isLinearElement, } from "../element/typeChecks";
|
|
17
|
+
import { isIframeLikeOrItsLabel, createPlaceholderEmbeddableLabel, } from "../element/embeddable";
|
|
18
|
+
import { elementOverlapsWithFrame, getTargetFrame, isElementInFrame, } from "../frame";
|
|
19
|
+
import "canvas-roundrect-polyfill";
|
|
20
|
+
export const DEFAULT_SPACING = 2;
|
|
21
|
+
const strokeRectWithRotation = (context, x, y, width, height, cx, cy, angle, fill = false,
|
|
22
|
+
/** should account for zoom */
|
|
23
|
+
radius = 0) => {
|
|
24
|
+
context.save();
|
|
25
|
+
context.translate(cx, cy);
|
|
26
|
+
context.rotate(angle);
|
|
27
|
+
if (fill) {
|
|
28
|
+
context.fillRect(x - cx, y - cy, width, height);
|
|
29
|
+
}
|
|
30
|
+
if (radius && context.roundRect) {
|
|
31
|
+
context.beginPath();
|
|
32
|
+
context.roundRect(x - cx, y - cy, width, height, radius);
|
|
33
|
+
context.stroke();
|
|
34
|
+
context.closePath();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
context.strokeRect(x - cx, y - cy, width, height);
|
|
38
|
+
}
|
|
39
|
+
context.restore();
|
|
40
|
+
};
|
|
41
|
+
const strokeDiamondWithRotation = (context, width, height, cx, cy, angle) => {
|
|
42
|
+
context.save();
|
|
43
|
+
context.translate(cx, cy);
|
|
44
|
+
context.rotate(angle);
|
|
45
|
+
context.beginPath();
|
|
46
|
+
context.moveTo(0, height / 2);
|
|
47
|
+
context.lineTo(width / 2, 0);
|
|
48
|
+
context.lineTo(0, -height / 2);
|
|
49
|
+
context.lineTo(-width / 2, 0);
|
|
50
|
+
context.closePath();
|
|
51
|
+
context.stroke();
|
|
52
|
+
context.restore();
|
|
53
|
+
};
|
|
54
|
+
const strokeEllipseWithRotation = (context, width, height, cx, cy, angle) => {
|
|
55
|
+
context.beginPath();
|
|
56
|
+
context.ellipse(cx, cy, width / 2, height / 2, angle, 0, Math.PI * 2);
|
|
57
|
+
context.stroke();
|
|
58
|
+
};
|
|
59
|
+
const fillCircle = (context, cx, cy, radius, stroke = true) => {
|
|
60
|
+
context.beginPath();
|
|
61
|
+
context.arc(cx, cy, radius, 0, Math.PI * 2);
|
|
62
|
+
context.fill();
|
|
63
|
+
if (stroke) {
|
|
64
|
+
context.stroke();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const strokeGrid = (context, gridSize, scrollX, scrollY, zoom, width, height) => {
|
|
68
|
+
const BOLD_LINE_FREQUENCY = 5;
|
|
69
|
+
let GridLineColor;
|
|
70
|
+
(function (GridLineColor) {
|
|
71
|
+
GridLineColor["Bold"] = "#cccccc";
|
|
72
|
+
GridLineColor["Regular"] = "#e5e5e5";
|
|
73
|
+
})(GridLineColor || (GridLineColor = {}));
|
|
74
|
+
const offsetX = -Math.round(zoom.value / gridSize) * gridSize + (scrollX % gridSize);
|
|
75
|
+
const offsetY = -Math.round(zoom.value / gridSize) * gridSize + (scrollY % gridSize);
|
|
76
|
+
const lineWidth = Math.min(1 / zoom.value, 1);
|
|
77
|
+
const spaceWidth = 1 / zoom.value;
|
|
78
|
+
const lineDash = [lineWidth * 3, spaceWidth + (lineWidth + spaceWidth)];
|
|
79
|
+
context.save();
|
|
80
|
+
context.lineWidth = lineWidth;
|
|
81
|
+
for (let x = offsetX; x < offsetX + width + gridSize * 2; x += gridSize) {
|
|
82
|
+
const isBold = Math.round(x - scrollX) % (BOLD_LINE_FREQUENCY * gridSize) === 0;
|
|
83
|
+
context.beginPath();
|
|
84
|
+
context.setLineDash(isBold ? [] : lineDash);
|
|
85
|
+
context.strokeStyle = isBold ? GridLineColor.Bold : GridLineColor.Regular;
|
|
86
|
+
context.moveTo(x, offsetY - gridSize);
|
|
87
|
+
context.lineTo(x, offsetY + height + gridSize * 2);
|
|
88
|
+
context.stroke();
|
|
89
|
+
}
|
|
90
|
+
for (let y = offsetY; y < offsetY + height + gridSize * 2; y += gridSize) {
|
|
91
|
+
const isBold = Math.round(y - scrollY) % (BOLD_LINE_FREQUENCY * gridSize) === 0;
|
|
92
|
+
context.beginPath();
|
|
93
|
+
context.setLineDash(isBold ? [] : lineDash);
|
|
94
|
+
context.strokeStyle = isBold ? GridLineColor.Bold : GridLineColor.Regular;
|
|
95
|
+
context.moveTo(offsetX - gridSize, y);
|
|
96
|
+
context.lineTo(offsetX + width + gridSize * 2, y);
|
|
97
|
+
context.stroke();
|
|
98
|
+
}
|
|
99
|
+
context.restore();
|
|
100
|
+
};
|
|
101
|
+
const renderSingleLinearPoint = (context, appState, point, radius, isSelected, isPhantomPoint = false) => {
|
|
102
|
+
context.strokeStyle = "#5e5ad8";
|
|
103
|
+
context.setLineDash([]);
|
|
104
|
+
context.fillStyle = "rgba(255, 255, 255, 0.9)";
|
|
105
|
+
if (isSelected) {
|
|
106
|
+
context.fillStyle = "rgba(134, 131, 226, 0.9)";
|
|
107
|
+
}
|
|
108
|
+
else if (isPhantomPoint) {
|
|
109
|
+
context.fillStyle = "rgba(177, 151, 252, 0.7)";
|
|
110
|
+
}
|
|
111
|
+
fillCircle(context, point[0], point[1], radius / appState.zoom.value, !isPhantomPoint);
|
|
112
|
+
};
|
|
113
|
+
const renderLinearPointHandles = (context, appState, element) => {
|
|
114
|
+
if (!appState.selectedLinearElement) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
context.save();
|
|
118
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
119
|
+
context.lineWidth = 1 / appState.zoom.value;
|
|
120
|
+
const points = LinearElementEditor.getPointsGlobalCoordinates(element);
|
|
121
|
+
const { POINT_HANDLE_SIZE } = LinearElementEditor;
|
|
122
|
+
const radius = appState.editingLinearElement
|
|
123
|
+
? POINT_HANDLE_SIZE
|
|
124
|
+
: POINT_HANDLE_SIZE / 2;
|
|
125
|
+
points.forEach((point, idx) => {
|
|
126
|
+
const isSelected = !!appState.editingLinearElement?.selectedPointsIndices?.includes(idx);
|
|
127
|
+
renderSingleLinearPoint(context, appState, point, radius, isSelected);
|
|
128
|
+
});
|
|
129
|
+
//Rendering segment mid points
|
|
130
|
+
const midPoints = LinearElementEditor.getEditorMidPoints(element, appState).filter((midPoint) => midPoint !== null);
|
|
131
|
+
midPoints.forEach((segmentMidPoint) => {
|
|
132
|
+
if (appState?.selectedLinearElement?.segmentMidPointHoveredCoords &&
|
|
133
|
+
LinearElementEditor.arePointsEqual(segmentMidPoint, appState.selectedLinearElement.segmentMidPointHoveredCoords)) {
|
|
134
|
+
// The order of renderingSingleLinearPoint and highLight points is different
|
|
135
|
+
// inside vs outside editor as hover states are different,
|
|
136
|
+
// in editor when hovered the original point is not visible as hover state fully covers it whereas outside the
|
|
137
|
+
// editor original point is visible and hover state is just an outer circle.
|
|
138
|
+
if (appState.editingLinearElement) {
|
|
139
|
+
renderSingleLinearPoint(context, appState, segmentMidPoint, radius, false);
|
|
140
|
+
highlightPoint(segmentMidPoint, context, appState);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
highlightPoint(segmentMidPoint, context, appState);
|
|
144
|
+
renderSingleLinearPoint(context, appState, segmentMidPoint, radius, false);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else if (appState.editingLinearElement || points.length === 2) {
|
|
148
|
+
renderSingleLinearPoint(context, appState, segmentMidPoint, POINT_HANDLE_SIZE / 2, false, true);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
context.restore();
|
|
152
|
+
};
|
|
153
|
+
const highlightPoint = (point, context, appState) => {
|
|
154
|
+
context.fillStyle = "rgba(105, 101, 219, 0.4)";
|
|
155
|
+
fillCircle(context, point[0], point[1], LinearElementEditor.POINT_HANDLE_SIZE / appState.zoom.value, false);
|
|
156
|
+
};
|
|
157
|
+
const renderLinearElementPointHighlight = (context, appState) => {
|
|
158
|
+
const { elementId, hoverPointIndex } = appState.selectedLinearElement;
|
|
159
|
+
if (appState.editingLinearElement?.selectedPointsIndices?.includes(hoverPointIndex)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const element = LinearElementEditor.getElement(elementId);
|
|
163
|
+
if (!element) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const point = LinearElementEditor.getPointAtIndexGlobalCoordinates(element, hoverPointIndex);
|
|
167
|
+
context.save();
|
|
168
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
169
|
+
highlightPoint(point, context, appState);
|
|
170
|
+
context.restore();
|
|
171
|
+
};
|
|
172
|
+
const frameClip = (frame, context, renderConfig, appState) => {
|
|
173
|
+
context.translate(frame.x + appState.scrollX, frame.y + appState.scrollY);
|
|
174
|
+
context.beginPath();
|
|
175
|
+
if (context.roundRect) {
|
|
176
|
+
context.roundRect(0, 0, frame.width, frame.height, FRAME_STYLE.radius / appState.zoom.value);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
context.rect(0, 0, frame.width, frame.height);
|
|
180
|
+
}
|
|
181
|
+
context.clip();
|
|
182
|
+
context.translate(-(frame.x + appState.scrollX), -(frame.y + appState.scrollY));
|
|
183
|
+
};
|
|
184
|
+
const getNormalizedCanvasDimensions = (canvas, scale) => {
|
|
185
|
+
// When doing calculations based on canvas width we should used normalized one
|
|
186
|
+
return [canvas.width / scale, canvas.height / scale];
|
|
187
|
+
};
|
|
188
|
+
const bootstrapCanvas = ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }) => {
|
|
189
|
+
const context = canvas.getContext("2d");
|
|
190
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
191
|
+
context.scale(scale, scale);
|
|
192
|
+
if (isExporting && theme === "dark") {
|
|
193
|
+
context.filter = THEME_FILTER;
|
|
194
|
+
}
|
|
195
|
+
// Paint background
|
|
196
|
+
if (typeof viewBackgroundColor === "string") {
|
|
197
|
+
const hasTransparence = viewBackgroundColor === "transparent" ||
|
|
198
|
+
viewBackgroundColor.length === 5 || // #RGBA
|
|
199
|
+
viewBackgroundColor.length === 9 || // #RRGGBBA
|
|
200
|
+
/(hsla|rgba)\(/.test(viewBackgroundColor);
|
|
201
|
+
if (hasTransparence) {
|
|
202
|
+
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
203
|
+
}
|
|
204
|
+
context.save();
|
|
205
|
+
context.fillStyle = viewBackgroundColor;
|
|
206
|
+
context.fillRect(0, 0, normalizedWidth, normalizedHeight);
|
|
207
|
+
context.restore();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
211
|
+
}
|
|
212
|
+
return context;
|
|
213
|
+
};
|
|
214
|
+
const _renderInteractiveScene = ({ canvas, elements, visibleElements, selectedElements, scale, appState, renderConfig, }) => {
|
|
215
|
+
if (canvas === null) {
|
|
216
|
+
return { atLeastOneVisibleElement: false, elements };
|
|
217
|
+
}
|
|
218
|
+
const [normalizedWidth, normalizedHeight] = getNormalizedCanvasDimensions(canvas, scale);
|
|
219
|
+
const context = bootstrapCanvas({
|
|
220
|
+
canvas,
|
|
221
|
+
scale,
|
|
222
|
+
normalizedWidth,
|
|
223
|
+
normalizedHeight,
|
|
224
|
+
});
|
|
225
|
+
// Apply zoom
|
|
226
|
+
context.save();
|
|
227
|
+
context.scale(appState.zoom.value, appState.zoom.value);
|
|
228
|
+
let editingLinearElement = undefined;
|
|
229
|
+
visibleElements.forEach((element) => {
|
|
230
|
+
// Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to
|
|
231
|
+
// ShapeCache returns empty hence making sure that we get the
|
|
232
|
+
// correct element from visible elements
|
|
233
|
+
if (appState.editingLinearElement?.elementId === element.id) {
|
|
234
|
+
if (element) {
|
|
235
|
+
editingLinearElement = element;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
if (editingLinearElement) {
|
|
240
|
+
renderLinearPointHandles(context, appState, editingLinearElement);
|
|
241
|
+
}
|
|
242
|
+
// Paint selection element
|
|
243
|
+
if (appState.selectionElement) {
|
|
244
|
+
try {
|
|
245
|
+
renderSelectionElement(appState.selectionElement, context, appState);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
console.error(error);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (appState.isBindingEnabled) {
|
|
252
|
+
appState.suggestedBindings
|
|
253
|
+
.filter((binding) => binding != null)
|
|
254
|
+
.forEach((suggestedBinding) => {
|
|
255
|
+
renderBindingHighlight(context, appState, suggestedBinding);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (appState.frameToHighlight) {
|
|
259
|
+
renderFrameHighlight(context, appState, appState.frameToHighlight);
|
|
260
|
+
}
|
|
261
|
+
if (appState.elementsToHighlight) {
|
|
262
|
+
renderElementsBoxHighlight(context, appState, appState.elementsToHighlight);
|
|
263
|
+
}
|
|
264
|
+
const isFrameSelected = selectedElements.some((element) => isFrameLikeElement(element));
|
|
265
|
+
// Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to
|
|
266
|
+
// ShapeCache returns empty hence making sure that we get the
|
|
267
|
+
// correct element from visible elements
|
|
268
|
+
if (selectedElements.length === 1 &&
|
|
269
|
+
appState.editingLinearElement?.elementId === selectedElements[0].id) {
|
|
270
|
+
renderLinearPointHandles(context, appState, selectedElements[0]);
|
|
271
|
+
}
|
|
272
|
+
if (appState.selectedLinearElement &&
|
|
273
|
+
appState.selectedLinearElement.hoverPointIndex >= 0) {
|
|
274
|
+
renderLinearElementPointHighlight(context, appState);
|
|
275
|
+
}
|
|
276
|
+
// Paint selected elements
|
|
277
|
+
if (!appState.multiElement && !appState.editingLinearElement) {
|
|
278
|
+
const showBoundingBox = shouldShowBoundingBox(selectedElements, appState);
|
|
279
|
+
const isSingleLinearElementSelected = selectedElements.length === 1 && isLinearElement(selectedElements[0]);
|
|
280
|
+
// render selected linear element points
|
|
281
|
+
if (isSingleLinearElementSelected &&
|
|
282
|
+
appState.selectedLinearElement?.elementId === selectedElements[0].id &&
|
|
283
|
+
!selectedElements[0].locked) {
|
|
284
|
+
renderLinearPointHandles(context, appState, selectedElements[0]);
|
|
285
|
+
}
|
|
286
|
+
const selectionColor = renderConfig.selectionColor || oc.black;
|
|
287
|
+
if (showBoundingBox) {
|
|
288
|
+
// Optimisation for finding quickly relevant element ids
|
|
289
|
+
const locallySelectedIds = selectedElements.reduce((acc, element) => {
|
|
290
|
+
acc[element.id] = true;
|
|
291
|
+
return acc;
|
|
292
|
+
}, {});
|
|
293
|
+
const selections = elements.reduce((acc, element) => {
|
|
294
|
+
const selectionColors = [];
|
|
295
|
+
// local user
|
|
296
|
+
if (locallySelectedIds[element.id] &&
|
|
297
|
+
!isSelectedViaGroup(appState, element)) {
|
|
298
|
+
selectionColors.push(selectionColor);
|
|
299
|
+
}
|
|
300
|
+
// remote users
|
|
301
|
+
if (renderConfig.remoteSelectedElementIds[element.id]) {
|
|
302
|
+
selectionColors.push(...renderConfig.remoteSelectedElementIds[element.id].map((socketId) => {
|
|
303
|
+
const background = getClientColor(socketId);
|
|
304
|
+
return background;
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
if (selectionColors.length) {
|
|
308
|
+
const [elementX1, elementY1, elementX2, elementY2, cx, cy] = getElementAbsoluteCoords(element, true);
|
|
309
|
+
acc.push({
|
|
310
|
+
angle: element.angle,
|
|
311
|
+
elementX1,
|
|
312
|
+
elementY1,
|
|
313
|
+
elementX2,
|
|
314
|
+
elementY2,
|
|
315
|
+
selectionColors,
|
|
316
|
+
dashed: !!renderConfig.remoteSelectedElementIds[element.id],
|
|
317
|
+
cx,
|
|
318
|
+
cy,
|
|
319
|
+
activeEmbeddable: appState.activeEmbeddable?.element === element &&
|
|
320
|
+
appState.activeEmbeddable.state === "active",
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return acc;
|
|
324
|
+
}, []);
|
|
325
|
+
const addSelectionForGroupId = (groupId) => {
|
|
326
|
+
const groupElements = getElementsInGroup(elements, groupId);
|
|
327
|
+
const [elementX1, elementY1, elementX2, elementY2] = getCommonBounds(groupElements);
|
|
328
|
+
selections.push({
|
|
329
|
+
angle: 0,
|
|
330
|
+
elementX1,
|
|
331
|
+
elementX2,
|
|
332
|
+
elementY1,
|
|
333
|
+
elementY2,
|
|
334
|
+
selectionColors: [oc.black],
|
|
335
|
+
dashed: true,
|
|
336
|
+
cx: elementX1 + (elementX2 - elementX1) / 2,
|
|
337
|
+
cy: elementY1 + (elementY2 - elementY1) / 2,
|
|
338
|
+
activeEmbeddable: false,
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
for (const groupId of getSelectedGroupIds(appState)) {
|
|
342
|
+
// TODO: support multiplayer selected group IDs
|
|
343
|
+
addSelectionForGroupId(groupId);
|
|
344
|
+
}
|
|
345
|
+
if (appState.editingGroupId) {
|
|
346
|
+
addSelectionForGroupId(appState.editingGroupId);
|
|
347
|
+
}
|
|
348
|
+
selections.forEach((selection) => renderSelectionBorder(context, appState, selection));
|
|
349
|
+
}
|
|
350
|
+
// Paint resize transformHandles
|
|
351
|
+
context.save();
|
|
352
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
353
|
+
if (selectedElements.length === 1) {
|
|
354
|
+
context.fillStyle = oc.white;
|
|
355
|
+
const transformHandles = getTransformHandles(selectedElements[0], appState.zoom, "mouse");
|
|
356
|
+
if (!appState.viewModeEnabled && showBoundingBox) {
|
|
357
|
+
renderTransformHandles(context, renderConfig, appState, transformHandles, selectedElements[0].angle);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else if (selectedElements.length > 1 && !appState.isRotating) {
|
|
361
|
+
const dashedLinePadding = (DEFAULT_SPACING * 2) / appState.zoom.value;
|
|
362
|
+
context.fillStyle = oc.white;
|
|
363
|
+
const [x1, y1, x2, y2] = getCommonBounds(selectedElements);
|
|
364
|
+
const initialLineDash = context.getLineDash();
|
|
365
|
+
context.setLineDash([2 / appState.zoom.value]);
|
|
366
|
+
const lineWidth = context.lineWidth;
|
|
367
|
+
context.lineWidth = 1 / appState.zoom.value;
|
|
368
|
+
context.strokeStyle = selectionColor;
|
|
369
|
+
strokeRectWithRotation(context, x1 - dashedLinePadding, y1 - dashedLinePadding, x2 - x1 + dashedLinePadding * 2, y2 - y1 + dashedLinePadding * 2, (x1 + x2) / 2, (y1 + y2) / 2, 0);
|
|
370
|
+
context.lineWidth = lineWidth;
|
|
371
|
+
context.setLineDash(initialLineDash);
|
|
372
|
+
const transformHandles = getTransformHandlesFromCoords([x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2], 0, appState.zoom, "mouse", isFrameSelected
|
|
373
|
+
? OMIT_SIDES_FOR_FRAME
|
|
374
|
+
: OMIT_SIDES_FOR_MULTIPLE_ELEMENTS);
|
|
375
|
+
if (selectedElements.some((element) => !element.locked)) {
|
|
376
|
+
renderTransformHandles(context, renderConfig, appState, transformHandles, 0);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
context.restore();
|
|
380
|
+
}
|
|
381
|
+
renderSnaps(context, appState);
|
|
382
|
+
// Reset zoom
|
|
383
|
+
context.restore();
|
|
384
|
+
// Paint remote pointers
|
|
385
|
+
for (const clientId in renderConfig.remotePointerViewportCoords) {
|
|
386
|
+
let { x, y } = renderConfig.remotePointerViewportCoords[clientId];
|
|
387
|
+
x -= appState.offsetLeft;
|
|
388
|
+
y -= appState.offsetTop;
|
|
389
|
+
const width = 11;
|
|
390
|
+
const height = 14;
|
|
391
|
+
const isOutOfBounds = x < 0 ||
|
|
392
|
+
x > normalizedWidth - width ||
|
|
393
|
+
y < 0 ||
|
|
394
|
+
y > normalizedHeight - height;
|
|
395
|
+
x = Math.max(x, 0);
|
|
396
|
+
x = Math.min(x, normalizedWidth - width);
|
|
397
|
+
y = Math.max(y, 0);
|
|
398
|
+
y = Math.min(y, normalizedHeight - height);
|
|
399
|
+
const background = getClientColor(clientId);
|
|
400
|
+
context.save();
|
|
401
|
+
context.strokeStyle = background;
|
|
402
|
+
context.fillStyle = background;
|
|
403
|
+
const userState = renderConfig.remotePointerUserStates[clientId];
|
|
404
|
+
const isInactive = isOutOfBounds ||
|
|
405
|
+
userState === UserIdleState.IDLE ||
|
|
406
|
+
userState === UserIdleState.AWAY;
|
|
407
|
+
if (isInactive) {
|
|
408
|
+
context.globalAlpha = 0.3;
|
|
409
|
+
}
|
|
410
|
+
if (renderConfig.remotePointerButton &&
|
|
411
|
+
renderConfig.remotePointerButton[clientId] === "down") {
|
|
412
|
+
context.beginPath();
|
|
413
|
+
context.arc(x, y, 15, 0, 2 * Math.PI, false);
|
|
414
|
+
context.lineWidth = 3;
|
|
415
|
+
context.strokeStyle = "#ffffff88";
|
|
416
|
+
context.stroke();
|
|
417
|
+
context.closePath();
|
|
418
|
+
context.beginPath();
|
|
419
|
+
context.arc(x, y, 15, 0, 2 * Math.PI, false);
|
|
420
|
+
context.lineWidth = 1;
|
|
421
|
+
context.strokeStyle = background;
|
|
422
|
+
context.stroke();
|
|
423
|
+
context.closePath();
|
|
424
|
+
}
|
|
425
|
+
// Background (white outline) for arrow
|
|
426
|
+
context.fillStyle = oc.white;
|
|
427
|
+
context.strokeStyle = oc.white;
|
|
428
|
+
context.lineWidth = 6;
|
|
429
|
+
context.lineJoin = "round";
|
|
430
|
+
context.beginPath();
|
|
431
|
+
context.moveTo(x, y);
|
|
432
|
+
context.lineTo(x + 0, y + 14);
|
|
433
|
+
context.lineTo(x + 4, y + 9);
|
|
434
|
+
context.lineTo(x + 11, y + 8);
|
|
435
|
+
context.closePath();
|
|
436
|
+
context.stroke();
|
|
437
|
+
context.fill();
|
|
438
|
+
// Arrow
|
|
439
|
+
context.fillStyle = background;
|
|
440
|
+
context.strokeStyle = background;
|
|
441
|
+
context.lineWidth = 2;
|
|
442
|
+
context.lineJoin = "round";
|
|
443
|
+
context.beginPath();
|
|
444
|
+
if (isInactive) {
|
|
445
|
+
context.moveTo(x - 1, y - 1);
|
|
446
|
+
context.lineTo(x - 1, y + 15);
|
|
447
|
+
context.lineTo(x + 5, y + 10);
|
|
448
|
+
context.lineTo(x + 12, y + 9);
|
|
449
|
+
context.closePath();
|
|
450
|
+
context.fill();
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
context.moveTo(x, y);
|
|
454
|
+
context.lineTo(x + 0, y + 14);
|
|
455
|
+
context.lineTo(x + 4, y + 9);
|
|
456
|
+
context.lineTo(x + 11, y + 8);
|
|
457
|
+
context.closePath();
|
|
458
|
+
context.fill();
|
|
459
|
+
context.stroke();
|
|
460
|
+
}
|
|
461
|
+
const username = renderConfig.remotePointerUsernames[clientId] || "";
|
|
462
|
+
if (!isOutOfBounds && username) {
|
|
463
|
+
context.font = "600 12px sans-serif"; // font has to be set before context.measureText()
|
|
464
|
+
const offsetX = x + width / 2;
|
|
465
|
+
const offsetY = y + height + 2;
|
|
466
|
+
const paddingHorizontal = 5;
|
|
467
|
+
const paddingVertical = 3;
|
|
468
|
+
const measure = context.measureText(username);
|
|
469
|
+
const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent;
|
|
470
|
+
const finalHeight = Math.max(measureHeight, 12);
|
|
471
|
+
const boxX = offsetX - 1;
|
|
472
|
+
const boxY = offsetY - 1;
|
|
473
|
+
const boxWidth = measure.width + 2 + paddingHorizontal * 2 + 2;
|
|
474
|
+
const boxHeight = finalHeight + 2 + paddingVertical * 2 + 2;
|
|
475
|
+
if (context.roundRect) {
|
|
476
|
+
context.beginPath();
|
|
477
|
+
context.roundRect(boxX, boxY, boxWidth, boxHeight, 8);
|
|
478
|
+
context.fillStyle = background;
|
|
479
|
+
context.fill();
|
|
480
|
+
context.strokeStyle = oc.white;
|
|
481
|
+
context.stroke();
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
roundRect(context, boxX, boxY, boxWidth, boxHeight, 8, oc.white);
|
|
485
|
+
}
|
|
486
|
+
context.fillStyle = oc.black;
|
|
487
|
+
context.fillText(username, offsetX + paddingHorizontal + 1, offsetY +
|
|
488
|
+
paddingVertical +
|
|
489
|
+
measure.actualBoundingBoxAscent +
|
|
490
|
+
Math.floor((finalHeight - measureHeight) / 2) +
|
|
491
|
+
2);
|
|
492
|
+
}
|
|
493
|
+
context.restore();
|
|
494
|
+
context.closePath();
|
|
495
|
+
}
|
|
496
|
+
// Paint scrollbars
|
|
497
|
+
let scrollBars;
|
|
498
|
+
if (renderConfig.renderScrollbars) {
|
|
499
|
+
scrollBars = getScrollBars(elements, normalizedWidth, normalizedHeight, appState);
|
|
500
|
+
context.save();
|
|
501
|
+
context.fillStyle = SCROLLBAR_COLOR;
|
|
502
|
+
context.strokeStyle = "rgba(255,255,255,0.8)";
|
|
503
|
+
[scrollBars.horizontal, scrollBars.vertical].forEach((scrollBar) => {
|
|
504
|
+
if (scrollBar) {
|
|
505
|
+
roundRect(context, scrollBar.x, scrollBar.y, scrollBar.width, scrollBar.height, SCROLLBAR_WIDTH / 2);
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
context.restore();
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
scrollBars,
|
|
512
|
+
atLeastOneVisibleElement: visibleElements.length > 0,
|
|
513
|
+
elements,
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
const _renderStaticScene = ({ canvas, rc, elements, visibleElements, scale, appState, renderConfig, }) => {
|
|
517
|
+
if (canvas === null) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
const { renderGrid = true, isExporting } = renderConfig;
|
|
521
|
+
const [normalizedWidth, normalizedHeight] = getNormalizedCanvasDimensions(canvas, scale);
|
|
522
|
+
const context = bootstrapCanvas({
|
|
523
|
+
canvas,
|
|
524
|
+
scale,
|
|
525
|
+
normalizedWidth,
|
|
526
|
+
normalizedHeight,
|
|
527
|
+
theme: appState.theme,
|
|
528
|
+
isExporting,
|
|
529
|
+
viewBackgroundColor: appState.viewBackgroundColor,
|
|
530
|
+
});
|
|
531
|
+
// Apply zoom
|
|
532
|
+
context.scale(appState.zoom.value, appState.zoom.value);
|
|
533
|
+
// Grid
|
|
534
|
+
if (renderGrid && appState.gridSize) {
|
|
535
|
+
strokeGrid(context, appState.gridSize, appState.scrollX, appState.scrollY, appState.zoom, normalizedWidth / appState.zoom.value, normalizedHeight / appState.zoom.value);
|
|
536
|
+
}
|
|
537
|
+
const groupsToBeAddedToFrame = new Set();
|
|
538
|
+
visibleElements.forEach((element) => {
|
|
539
|
+
if (element.groupIds.length > 0 &&
|
|
540
|
+
appState.frameToHighlight &&
|
|
541
|
+
appState.selectedElementIds[element.id] &&
|
|
542
|
+
(elementOverlapsWithFrame(element, appState.frameToHighlight) ||
|
|
543
|
+
element.groupIds.find((groupId) => groupsToBeAddedToFrame.has(groupId)))) {
|
|
544
|
+
element.groupIds.forEach((groupId) => groupsToBeAddedToFrame.add(groupId));
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
// Paint visible elements
|
|
548
|
+
visibleElements
|
|
549
|
+
.filter((el) => !isIframeLikeOrItsLabel(el))
|
|
550
|
+
.forEach((element) => {
|
|
551
|
+
try {
|
|
552
|
+
const frameId = element.frameId || appState.frameToHighlight?.id;
|
|
553
|
+
if (frameId &&
|
|
554
|
+
appState.frameRendering.enabled &&
|
|
555
|
+
appState.frameRendering.clip) {
|
|
556
|
+
context.save();
|
|
557
|
+
const frame = getTargetFrame(element, appState);
|
|
558
|
+
// TODO do we need to check isElementInFrame here?
|
|
559
|
+
if (frame && isElementInFrame(element, elements, appState)) {
|
|
560
|
+
frameClip(frame, context, renderConfig, appState);
|
|
561
|
+
}
|
|
562
|
+
renderElement(element, rc, context, renderConfig, appState);
|
|
563
|
+
context.restore();
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
renderElement(element, rc, context, renderConfig, appState);
|
|
567
|
+
}
|
|
568
|
+
if (!isExporting) {
|
|
569
|
+
renderLinkIcon(element, context, appState);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
console.error(error);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
// render embeddables on top
|
|
577
|
+
visibleElements
|
|
578
|
+
.filter((el) => isIframeLikeOrItsLabel(el))
|
|
579
|
+
.forEach((element) => {
|
|
580
|
+
try {
|
|
581
|
+
const render = () => {
|
|
582
|
+
renderElement(element, rc, context, renderConfig, appState);
|
|
583
|
+
if (isIframeLikeElement(element) &&
|
|
584
|
+
(isExporting ||
|
|
585
|
+
(isEmbeddableElement(element) && !element.validated)) &&
|
|
586
|
+
element.width &&
|
|
587
|
+
element.height) {
|
|
588
|
+
const label = createPlaceholderEmbeddableLabel(element);
|
|
589
|
+
renderElement(label, rc, context, renderConfig, appState);
|
|
590
|
+
}
|
|
591
|
+
if (!isExporting) {
|
|
592
|
+
renderLinkIcon(element, context, appState);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
// - when exporting the whole canvas, we DO NOT apply clipping
|
|
596
|
+
// - when we are exporting a particular frame, apply clipping
|
|
597
|
+
// if the containing frame is not selected, apply clipping
|
|
598
|
+
const frameId = element.frameId || appState.frameToHighlight?.id;
|
|
599
|
+
if (frameId &&
|
|
600
|
+
appState.frameRendering.enabled &&
|
|
601
|
+
appState.frameRendering.clip) {
|
|
602
|
+
context.save();
|
|
603
|
+
const frame = getTargetFrame(element, appState);
|
|
604
|
+
if (frame && isElementInFrame(element, elements, appState)) {
|
|
605
|
+
frameClip(frame, context, renderConfig, appState);
|
|
606
|
+
}
|
|
607
|
+
render();
|
|
608
|
+
context.restore();
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
render();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
console.error(error);
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
/** throttled to animation framerate */
|
|
620
|
+
const renderInteractiveSceneThrottled = throttleRAF((config) => {
|
|
621
|
+
const ret = _renderInteractiveScene(config);
|
|
622
|
+
config.callback?.(ret);
|
|
623
|
+
}, { trailing: true });
|
|
624
|
+
/**
|
|
625
|
+
* Interactive scene is the ui-canvas where we render boundinb boxes, selections
|
|
626
|
+
* and other ui stuff.
|
|
627
|
+
*/
|
|
628
|
+
export const renderInteractiveScene = (renderConfig, throttle) => {
|
|
629
|
+
if (throttle) {
|
|
630
|
+
renderInteractiveSceneThrottled(renderConfig);
|
|
631
|
+
return undefined;
|
|
632
|
+
}
|
|
633
|
+
const ret = _renderInteractiveScene(renderConfig);
|
|
634
|
+
renderConfig.callback(ret);
|
|
635
|
+
return ret;
|
|
636
|
+
};
|
|
637
|
+
/** throttled to animation framerate */
|
|
638
|
+
const renderStaticSceneThrottled = throttleRAF((config) => {
|
|
639
|
+
_renderStaticScene(config);
|
|
640
|
+
}, { trailing: true });
|
|
641
|
+
/**
|
|
642
|
+
* Static scene is the non-ui canvas where we render elements.
|
|
643
|
+
*/
|
|
644
|
+
export const renderStaticScene = (renderConfig, throttle) => {
|
|
645
|
+
if (throttle) {
|
|
646
|
+
renderStaticSceneThrottled(renderConfig);
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
_renderStaticScene(renderConfig);
|
|
650
|
+
};
|
|
651
|
+
export const cancelRender = () => {
|
|
652
|
+
renderInteractiveSceneThrottled.cancel();
|
|
653
|
+
renderStaticSceneThrottled.cancel();
|
|
654
|
+
};
|
|
655
|
+
const renderTransformHandles = (context, renderConfig, appState, transformHandles, angle) => {
|
|
656
|
+
Object.keys(transformHandles).forEach((key) => {
|
|
657
|
+
const transformHandle = transformHandles[key];
|
|
658
|
+
if (transformHandle !== undefined) {
|
|
659
|
+
const [x, y, width, height] = transformHandle;
|
|
660
|
+
context.save();
|
|
661
|
+
context.lineWidth = 1 / appState.zoom.value;
|
|
662
|
+
if (renderConfig.selectionColor) {
|
|
663
|
+
context.strokeStyle = renderConfig.selectionColor;
|
|
664
|
+
}
|
|
665
|
+
if (key === "rotation") {
|
|
666
|
+
fillCircle(context, x + width / 2, y + height / 2, width / 2);
|
|
667
|
+
// prefer round corners if roundRect API is available
|
|
668
|
+
}
|
|
669
|
+
else if (context.roundRect) {
|
|
670
|
+
context.beginPath();
|
|
671
|
+
context.roundRect(x, y, width, height, 2 / appState.zoom.value);
|
|
672
|
+
context.fill();
|
|
673
|
+
context.stroke();
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
strokeRectWithRotation(context, x, y, width, height, x + width / 2, y + height / 2, angle, true);
|
|
677
|
+
}
|
|
678
|
+
context.restore();
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
};
|
|
682
|
+
const renderSelectionBorder = (context, appState, elementProperties, padding = DEFAULT_SPACING * 2) => {
|
|
683
|
+
const { angle, elementX1, elementY1, elementX2, elementY2, selectionColors, cx, cy, dashed, activeEmbeddable, } = elementProperties;
|
|
684
|
+
const elementWidth = elementX2 - elementX1;
|
|
685
|
+
const elementHeight = elementY2 - elementY1;
|
|
686
|
+
const linePadding = padding / appState.zoom.value;
|
|
687
|
+
const lineWidth = 8 / appState.zoom.value;
|
|
688
|
+
const spaceWidth = 4 / appState.zoom.value;
|
|
689
|
+
context.save();
|
|
690
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
691
|
+
context.lineWidth = (activeEmbeddable ? 4 : 1) / appState.zoom.value;
|
|
692
|
+
const count = selectionColors.length;
|
|
693
|
+
for (let index = 0; index < count; ++index) {
|
|
694
|
+
context.strokeStyle = selectionColors[index];
|
|
695
|
+
if (dashed) {
|
|
696
|
+
context.setLineDash([
|
|
697
|
+
lineWidth,
|
|
698
|
+
spaceWidth + (lineWidth + spaceWidth) * (count - 1),
|
|
699
|
+
]);
|
|
700
|
+
}
|
|
701
|
+
context.lineDashOffset = (lineWidth + spaceWidth) * index;
|
|
702
|
+
strokeRectWithRotation(context, elementX1 - linePadding, elementY1 - linePadding, elementWidth + linePadding * 2, elementHeight + linePadding * 2, cx, cy, angle);
|
|
703
|
+
}
|
|
704
|
+
context.restore();
|
|
705
|
+
};
|
|
706
|
+
const renderBindingHighlight = (context, appState, suggestedBinding) => {
|
|
707
|
+
const renderHighlight = Array.isArray(suggestedBinding)
|
|
708
|
+
? renderBindingHighlightForSuggestedPointBinding
|
|
709
|
+
: renderBindingHighlightForBindableElement;
|
|
710
|
+
context.save();
|
|
711
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
712
|
+
renderHighlight(context, suggestedBinding);
|
|
713
|
+
context.restore();
|
|
714
|
+
};
|
|
715
|
+
const renderBindingHighlightForBindableElement = (context, element) => {
|
|
716
|
+
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
|
|
717
|
+
const width = x2 - x1;
|
|
718
|
+
const height = y2 - y1;
|
|
719
|
+
const threshold = maxBindingGap(element, width, height);
|
|
720
|
+
// So that we don't overlap the element itself
|
|
721
|
+
const strokeOffset = 4;
|
|
722
|
+
context.strokeStyle = "rgba(0,0,0,.05)";
|
|
723
|
+
context.lineWidth = threshold - strokeOffset;
|
|
724
|
+
const padding = strokeOffset / 2 + threshold / 2;
|
|
725
|
+
switch (element.type) {
|
|
726
|
+
case "rectangle":
|
|
727
|
+
case "text":
|
|
728
|
+
case "image":
|
|
729
|
+
case "iframe":
|
|
730
|
+
case "embeddable":
|
|
731
|
+
case "frame":
|
|
732
|
+
case "magicframe":
|
|
733
|
+
strokeRectWithRotation(context, x1 - padding, y1 - padding, width + padding * 2, height + padding * 2, x1 + width / 2, y1 + height / 2, element.angle);
|
|
734
|
+
break;
|
|
735
|
+
case "diamond":
|
|
736
|
+
const side = Math.hypot(width, height);
|
|
737
|
+
const wPadding = (padding * side) / height;
|
|
738
|
+
const hPadding = (padding * side) / width;
|
|
739
|
+
strokeDiamondWithRotation(context, width + wPadding * 2, height + hPadding * 2, x1 + width / 2, y1 + height / 2, element.angle);
|
|
740
|
+
break;
|
|
741
|
+
case "ellipse":
|
|
742
|
+
strokeEllipseWithRotation(context, width + padding * 2, height + padding * 2, x1 + width / 2, y1 + height / 2, element.angle);
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
const renderFrameHighlight = (context, appState, frame) => {
|
|
747
|
+
const [x1, y1, x2, y2] = getElementAbsoluteCoords(frame);
|
|
748
|
+
const width = x2 - x1;
|
|
749
|
+
const height = y2 - y1;
|
|
750
|
+
context.strokeStyle = "rgb(0,118,255)";
|
|
751
|
+
context.lineWidth = FRAME_STYLE.strokeWidth / appState.zoom.value;
|
|
752
|
+
context.save();
|
|
753
|
+
context.translate(appState.scrollX, appState.scrollY);
|
|
754
|
+
strokeRectWithRotation(context, x1, y1, width, height, x1 + width / 2, y1 + height / 2, frame.angle, false, FRAME_STYLE.radius / appState.zoom.value);
|
|
755
|
+
context.restore();
|
|
756
|
+
};
|
|
757
|
+
const renderElementsBoxHighlight = (context, appState, elements) => {
|
|
758
|
+
const individualElements = elements.filter((element) => element.groupIds.length === 0);
|
|
759
|
+
const elementsInGroups = elements.filter((element) => element.groupIds.length > 0);
|
|
760
|
+
const getSelectionFromElements = (elements) => {
|
|
761
|
+
const [elementX1, elementY1, elementX2, elementY2] = getCommonBounds(elements);
|
|
762
|
+
return {
|
|
763
|
+
angle: 0,
|
|
764
|
+
elementX1,
|
|
765
|
+
elementX2,
|
|
766
|
+
elementY1,
|
|
767
|
+
elementY2,
|
|
768
|
+
selectionColors: ["rgb(0,118,255)"],
|
|
769
|
+
dashed: false,
|
|
770
|
+
cx: elementX1 + (elementX2 - elementX1) / 2,
|
|
771
|
+
cy: elementY1 + (elementY2 - elementY1) / 2,
|
|
772
|
+
activeEmbeddable: false,
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
const getSelectionForGroupId = (groupId) => {
|
|
776
|
+
const groupElements = getElementsInGroup(elements, groupId);
|
|
777
|
+
return getSelectionFromElements(groupElements);
|
|
778
|
+
};
|
|
779
|
+
Object.entries(selectGroupsFromGivenElements(elementsInGroups, appState))
|
|
780
|
+
.filter(([id, isSelected]) => isSelected)
|
|
781
|
+
.map(([id, isSelected]) => id)
|
|
782
|
+
.map((groupId) => getSelectionForGroupId(groupId))
|
|
783
|
+
.concat(individualElements.map((element) => getSelectionFromElements([element])))
|
|
784
|
+
.forEach((selection) => renderSelectionBorder(context, appState, selection));
|
|
785
|
+
};
|
|
786
|
+
const renderBindingHighlightForSuggestedPointBinding = (context, suggestedBinding) => {
|
|
787
|
+
const [element, startOrEnd, bindableElement] = suggestedBinding;
|
|
788
|
+
const threshold = maxBindingGap(bindableElement, bindableElement.width, bindableElement.height);
|
|
789
|
+
context.strokeStyle = "rgba(0,0,0,0)";
|
|
790
|
+
context.fillStyle = "rgba(0,0,0,.05)";
|
|
791
|
+
const pointIndices = startOrEnd === "both" ? [0, -1] : startOrEnd === "start" ? [0] : [-1];
|
|
792
|
+
pointIndices.forEach((index) => {
|
|
793
|
+
const [x, y] = LinearElementEditor.getPointAtIndexGlobalCoordinates(element, index);
|
|
794
|
+
fillCircle(context, x, y, threshold);
|
|
795
|
+
});
|
|
796
|
+
};
|
|
797
|
+
let linkCanvasCache;
|
|
798
|
+
const renderLinkIcon = (element, context, appState) => {
|
|
799
|
+
if (element.link && !appState.selectedElementIds[element.id]) {
|
|
800
|
+
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
|
|
801
|
+
const [x, y, width, height] = getLinkHandleFromCoords([x1, y1, x2, y2], element.angle, appState);
|
|
802
|
+
const centerX = x + width / 2;
|
|
803
|
+
const centerY = y + height / 2;
|
|
804
|
+
context.save();
|
|
805
|
+
context.translate(appState.scrollX + centerX, appState.scrollY + centerY);
|
|
806
|
+
context.rotate(element.angle);
|
|
807
|
+
if (!linkCanvasCache || linkCanvasCache.zoom !== appState.zoom.value) {
|
|
808
|
+
linkCanvasCache = document.createElement("canvas");
|
|
809
|
+
linkCanvasCache.zoom = appState.zoom.value;
|
|
810
|
+
linkCanvasCache.width =
|
|
811
|
+
width * window.devicePixelRatio * appState.zoom.value;
|
|
812
|
+
linkCanvasCache.height =
|
|
813
|
+
height * window.devicePixelRatio * appState.zoom.value;
|
|
814
|
+
const linkCanvasCacheContext = linkCanvasCache.getContext("2d");
|
|
815
|
+
linkCanvasCacheContext.scale(window.devicePixelRatio * appState.zoom.value, window.devicePixelRatio * appState.zoom.value);
|
|
816
|
+
linkCanvasCacheContext.fillStyle = "#fff";
|
|
817
|
+
linkCanvasCacheContext.fillRect(0, 0, width, height);
|
|
818
|
+
linkCanvasCacheContext.drawImage(EXTERNAL_LINK_IMG, 0, 0, width, height);
|
|
819
|
+
linkCanvasCacheContext.restore();
|
|
820
|
+
context.drawImage(linkCanvasCache, x - centerX, y - centerY, width, height);
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
context.drawImage(linkCanvasCache, x - centerX, y - centerY, width, height);
|
|
824
|
+
}
|
|
825
|
+
context.restore();
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
// This should be only called for exporting purposes
|
|
829
|
+
export const renderSceneToSvg = (elements, rsvg, svgRoot, files, renderConfig) => {
|
|
830
|
+
if (!svgRoot) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
// render elements
|
|
834
|
+
elements
|
|
835
|
+
.filter((el) => !isIframeLikeOrItsLabel(el))
|
|
836
|
+
.forEach((element) => {
|
|
837
|
+
if (!element.isDeleted) {
|
|
838
|
+
try {
|
|
839
|
+
renderElementToSvg(element, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);
|
|
840
|
+
}
|
|
841
|
+
catch (error) {
|
|
842
|
+
console.error(error);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
// render embeddables on top
|
|
847
|
+
elements
|
|
848
|
+
.filter((el) => isIframeLikeElement(el))
|
|
849
|
+
.forEach((element) => {
|
|
850
|
+
if (!element.isDeleted) {
|
|
851
|
+
try {
|
|
852
|
+
renderElementToSvg(element, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);
|
|
853
|
+
}
|
|
854
|
+
catch (error) {
|
|
855
|
+
console.error(error);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
};
|