@excalidraw/excalidraw 0.17.1-7441-e31f307 → 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-PJT4QCRY.js → chunk-LZCCI7PN.js} +4 -4
- package/dist/browser/excalidraw-assets/{image-KZSI6GAB.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 -6
- package/dist/index.css +0 -5796
- package/dist/index.js +0 -71305
- /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,500 @@
|
|
|
1
|
+
import { CODES, KEYS } from "../keys";
|
|
2
|
+
import { isWritableElement, getFontString, getFontFamilyString, isTestEnv, } from "../utils";
|
|
3
|
+
import Scene from "../scene/Scene";
|
|
4
|
+
import { isArrowElement, isBoundToContainer, isTextElement, } from "./typeChecks";
|
|
5
|
+
import { CLASSES, isSafari } from "../constants";
|
|
6
|
+
import { bumpVersion, mutateElement } from "./mutateElement";
|
|
7
|
+
import { getBoundTextElementId, getContainerElement, getTextElementAngle, getTextWidth, normalizeText, redrawTextBoundingBox, wrapText, getBoundTextMaxHeight, getBoundTextMaxWidth, computeContainerDimensionForBoundText, detectLineHeight, computeBoundTextPosition, } from "./textElement";
|
|
8
|
+
import { actionDecreaseFontSize, actionIncreaseFontSize, } from "../actions/actionProperties";
|
|
9
|
+
import { actionZoomIn, actionZoomOut } from "../actions/actionCanvas";
|
|
10
|
+
import { LinearElementEditor } from "./linearElementEditor";
|
|
11
|
+
import { parseClipboard } from "../clipboard";
|
|
12
|
+
const getTransform = (width, height, angle, appState, maxWidth, maxHeight) => {
|
|
13
|
+
const { zoom } = appState;
|
|
14
|
+
const degree = (180 * angle) / Math.PI;
|
|
15
|
+
let translateX = (width * (zoom.value - 1)) / 2;
|
|
16
|
+
let translateY = (height * (zoom.value - 1)) / 2;
|
|
17
|
+
if (width > maxWidth && zoom.value !== 1) {
|
|
18
|
+
translateX = (maxWidth * (zoom.value - 1)) / 2;
|
|
19
|
+
}
|
|
20
|
+
if (height > maxHeight && zoom.value !== 1) {
|
|
21
|
+
translateY = (maxHeight * (zoom.value - 1)) / 2;
|
|
22
|
+
}
|
|
23
|
+
return `translate(${translateX}px, ${translateY}px) scale(${zoom.value}) rotate(${degree}deg)`;
|
|
24
|
+
};
|
|
25
|
+
const originalContainerCache = {};
|
|
26
|
+
export const updateOriginalContainerCache = (id, height) => {
|
|
27
|
+
const data = originalContainerCache[id] || (originalContainerCache[id] = { height });
|
|
28
|
+
data.height = height;
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
export const resetOriginalContainerCache = (id) => {
|
|
32
|
+
if (originalContainerCache[id]) {
|
|
33
|
+
delete originalContainerCache[id];
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export const getOriginalContainerHeightFromCache = (id) => {
|
|
37
|
+
return originalContainerCache[id]?.height ?? null;
|
|
38
|
+
};
|
|
39
|
+
export const textWysiwyg = ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }) => {
|
|
40
|
+
const textPropertiesUpdated = (updatedTextElement, editable) => {
|
|
41
|
+
if (!editable.style.fontFamily || !editable.style.fontSize) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const currentFont = editable.style.fontFamily.replace(/"/g, "");
|
|
45
|
+
if (getFontFamilyString({ fontFamily: updatedTextElement.fontFamily }) !==
|
|
46
|
+
currentFont) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (`${updatedTextElement.fontSize}px` !== editable.style.fontSize) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
const updateWysiwygStyle = () => {
|
|
55
|
+
const appState = app.state;
|
|
56
|
+
const updatedTextElement = Scene.getScene(element)?.getElement(id);
|
|
57
|
+
if (!updatedTextElement) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const { textAlign, verticalAlign } = updatedTextElement;
|
|
61
|
+
if (updatedTextElement && isTextElement(updatedTextElement)) {
|
|
62
|
+
let coordX = updatedTextElement.x;
|
|
63
|
+
let coordY = updatedTextElement.y;
|
|
64
|
+
const container = getContainerElement(updatedTextElement);
|
|
65
|
+
let maxWidth = updatedTextElement.width;
|
|
66
|
+
let maxHeight = updatedTextElement.height;
|
|
67
|
+
let textElementWidth = updatedTextElement.width;
|
|
68
|
+
// Set to element height by default since that's
|
|
69
|
+
// what is going to be used for unbounded text
|
|
70
|
+
const textElementHeight = updatedTextElement.height;
|
|
71
|
+
if (container && updatedTextElement.containerId) {
|
|
72
|
+
if (isArrowElement(container)) {
|
|
73
|
+
const boundTextCoords = LinearElementEditor.getBoundTextElementPosition(container, updatedTextElement);
|
|
74
|
+
coordX = boundTextCoords.x;
|
|
75
|
+
coordY = boundTextCoords.y;
|
|
76
|
+
}
|
|
77
|
+
const propertiesUpdated = textPropertiesUpdated(updatedTextElement, editable);
|
|
78
|
+
let originalContainerData;
|
|
79
|
+
if (propertiesUpdated) {
|
|
80
|
+
originalContainerData = updateOriginalContainerCache(container.id, container.height);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
originalContainerData = originalContainerCache[container.id];
|
|
84
|
+
if (!originalContainerData) {
|
|
85
|
+
originalContainerData = updateOriginalContainerCache(container.id, container.height);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
maxWidth = getBoundTextMaxWidth(container);
|
|
89
|
+
maxHeight = getBoundTextMaxHeight(container, updatedTextElement);
|
|
90
|
+
// autogrow container height if text exceeds
|
|
91
|
+
if (!isArrowElement(container) && textElementHeight > maxHeight) {
|
|
92
|
+
const targetContainerHeight = computeContainerDimensionForBoundText(textElementHeight, container.type);
|
|
93
|
+
mutateElement(container, { height: targetContainerHeight });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
else if (
|
|
97
|
+
// autoshrink container height until original container height
|
|
98
|
+
// is reached when text is removed
|
|
99
|
+
!isArrowElement(container) &&
|
|
100
|
+
container.height > originalContainerData.height &&
|
|
101
|
+
textElementHeight < maxHeight) {
|
|
102
|
+
const targetContainerHeight = computeContainerDimensionForBoundText(textElementHeight, container.type);
|
|
103
|
+
mutateElement(container, { height: targetContainerHeight });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const { y } = computeBoundTextPosition(container, updatedTextElement);
|
|
107
|
+
coordY = y;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const [viewportX, viewportY] = getViewportCoords(coordX, coordY);
|
|
111
|
+
const initialSelectionStart = editable.selectionStart;
|
|
112
|
+
const initialSelectionEnd = editable.selectionEnd;
|
|
113
|
+
const initialLength = editable.value.length;
|
|
114
|
+
// restore cursor position after value updated so it doesn't
|
|
115
|
+
// go to the end of text when container auto expanded
|
|
116
|
+
if (initialSelectionStart === initialSelectionEnd &&
|
|
117
|
+
initialSelectionEnd !== initialLength) {
|
|
118
|
+
// get diff between length and selection end and shift
|
|
119
|
+
// the cursor by "diff" times to position correctly
|
|
120
|
+
const diff = initialLength - initialSelectionEnd;
|
|
121
|
+
editable.selectionStart = editable.value.length - diff;
|
|
122
|
+
editable.selectionEnd = editable.value.length - diff;
|
|
123
|
+
}
|
|
124
|
+
if (!container) {
|
|
125
|
+
maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value;
|
|
126
|
+
textElementWidth = Math.min(textElementWidth, maxWidth);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
textElementWidth += 0.5;
|
|
130
|
+
}
|
|
131
|
+
let lineHeight = updatedTextElement.lineHeight;
|
|
132
|
+
// In Safari the font size gets rounded off when rendering hence calculating the line height by rounding off font size
|
|
133
|
+
if (isSafari) {
|
|
134
|
+
lineHeight = detectLineHeight({
|
|
135
|
+
...updatedTextElement,
|
|
136
|
+
fontSize: Math.round(updatedTextElement.fontSize),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Make sure text editor height doesn't go beyond viewport
|
|
140
|
+
const editorMaxHeight = (appState.height - viewportY) / appState.zoom.value;
|
|
141
|
+
Object.assign(editable.style, {
|
|
142
|
+
font: getFontString(updatedTextElement),
|
|
143
|
+
// must be defined *after* font ¯\_(ツ)_/¯
|
|
144
|
+
lineHeight,
|
|
145
|
+
width: `${textElementWidth}px`,
|
|
146
|
+
height: `${textElementHeight}px`,
|
|
147
|
+
left: `${viewportX}px`,
|
|
148
|
+
top: `${viewportY}px`,
|
|
149
|
+
transform: getTransform(textElementWidth, textElementHeight, getTextElementAngle(updatedTextElement), appState, maxWidth, editorMaxHeight),
|
|
150
|
+
textAlign,
|
|
151
|
+
verticalAlign,
|
|
152
|
+
color: updatedTextElement.strokeColor,
|
|
153
|
+
opacity: updatedTextElement.opacity / 100,
|
|
154
|
+
filter: "var(--theme-filter)",
|
|
155
|
+
maxHeight: `${editorMaxHeight}px`,
|
|
156
|
+
});
|
|
157
|
+
editable.scrollTop = 0;
|
|
158
|
+
// For some reason updating font attribute doesn't set font family
|
|
159
|
+
// hence updating font family explicitly for test environment
|
|
160
|
+
if (isTestEnv()) {
|
|
161
|
+
editable.style.fontFamily = getFontFamilyString(updatedTextElement);
|
|
162
|
+
}
|
|
163
|
+
mutateElement(updatedTextElement, { x: coordX, y: coordY });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const editable = document.createElement("textarea");
|
|
167
|
+
editable.dir = "auto";
|
|
168
|
+
editable.tabIndex = 0;
|
|
169
|
+
editable.dataset.type = "wysiwyg";
|
|
170
|
+
// prevent line wrapping on Safari
|
|
171
|
+
editable.wrap = "off";
|
|
172
|
+
editable.classList.add("excalidraw-wysiwyg");
|
|
173
|
+
let whiteSpace = "pre";
|
|
174
|
+
let wordBreak = "normal";
|
|
175
|
+
if (isBoundToContainer(element)) {
|
|
176
|
+
whiteSpace = "pre-wrap";
|
|
177
|
+
wordBreak = "break-word";
|
|
178
|
+
}
|
|
179
|
+
Object.assign(editable.style, {
|
|
180
|
+
position: "absolute",
|
|
181
|
+
display: "inline-block",
|
|
182
|
+
minHeight: "1em",
|
|
183
|
+
backfaceVisibility: "hidden",
|
|
184
|
+
margin: 0,
|
|
185
|
+
padding: 0,
|
|
186
|
+
border: 0,
|
|
187
|
+
outline: 0,
|
|
188
|
+
resize: "none",
|
|
189
|
+
background: "transparent",
|
|
190
|
+
overflow: "hidden",
|
|
191
|
+
// must be specified because in dark mode canvas creates a stacking context
|
|
192
|
+
zIndex: "var(--zIndex-wysiwyg)",
|
|
193
|
+
wordBreak,
|
|
194
|
+
// prevent line wrapping (`whitespace: nowrap` doesn't work on FF)
|
|
195
|
+
whiteSpace,
|
|
196
|
+
overflowWrap: "break-word",
|
|
197
|
+
boxSizing: "content-box",
|
|
198
|
+
});
|
|
199
|
+
editable.value = element.originalText;
|
|
200
|
+
updateWysiwygStyle();
|
|
201
|
+
if (onChange) {
|
|
202
|
+
editable.onpaste = async (event) => {
|
|
203
|
+
const clipboardData = await parseClipboard(event, true);
|
|
204
|
+
if (!clipboardData.text) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const data = normalizeText(clipboardData.text);
|
|
208
|
+
if (!data) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const container = getContainerElement(element);
|
|
212
|
+
const font = getFontString({
|
|
213
|
+
fontSize: app.state.currentItemFontSize,
|
|
214
|
+
fontFamily: app.state.currentItemFontFamily,
|
|
215
|
+
});
|
|
216
|
+
if (container) {
|
|
217
|
+
const wrappedText = wrapText(`${editable.value}${data}`, font, getBoundTextMaxWidth(container));
|
|
218
|
+
const width = getTextWidth(wrappedText, font);
|
|
219
|
+
editable.style.width = `${width}px`;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
editable.oninput = () => {
|
|
223
|
+
onChange(normalizeText(editable.value));
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
editable.onkeydown = (event) => {
|
|
227
|
+
if (!event.shiftKey && actionZoomIn.keyTest(event)) {
|
|
228
|
+
event.preventDefault();
|
|
229
|
+
app.actionManager.executeAction(actionZoomIn);
|
|
230
|
+
updateWysiwygStyle();
|
|
231
|
+
}
|
|
232
|
+
else if (!event.shiftKey && actionZoomOut.keyTest(event)) {
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
app.actionManager.executeAction(actionZoomOut);
|
|
235
|
+
updateWysiwygStyle();
|
|
236
|
+
}
|
|
237
|
+
else if (actionDecreaseFontSize.keyTest(event)) {
|
|
238
|
+
app.actionManager.executeAction(actionDecreaseFontSize);
|
|
239
|
+
}
|
|
240
|
+
else if (actionIncreaseFontSize.keyTest(event)) {
|
|
241
|
+
app.actionManager.executeAction(actionIncreaseFontSize);
|
|
242
|
+
}
|
|
243
|
+
else if (event.key === KEYS.ESCAPE) {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
submittedViaKeyboard = true;
|
|
246
|
+
handleSubmit();
|
|
247
|
+
}
|
|
248
|
+
else if (event.key === KEYS.ENTER && event[KEYS.CTRL_OR_CMD]) {
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
submittedViaKeyboard = true;
|
|
254
|
+
handleSubmit();
|
|
255
|
+
}
|
|
256
|
+
else if (event.key === KEYS.TAB ||
|
|
257
|
+
(event[KEYS.CTRL_OR_CMD] &&
|
|
258
|
+
(event.code === CODES.BRACKET_LEFT ||
|
|
259
|
+
event.code === CODES.BRACKET_RIGHT))) {
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
if (event.isComposing) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
else if (event.shiftKey || event.code === CODES.BRACKET_LEFT) {
|
|
265
|
+
outdent();
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
indent();
|
|
269
|
+
}
|
|
270
|
+
// We must send an input event to resize the element
|
|
271
|
+
editable.dispatchEvent(new Event("input"));
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const TAB_SIZE = 4;
|
|
275
|
+
const TAB = " ".repeat(TAB_SIZE);
|
|
276
|
+
const RE_LEADING_TAB = new RegExp(`^ {1,${TAB_SIZE}}`);
|
|
277
|
+
const indent = () => {
|
|
278
|
+
const { selectionStart, selectionEnd } = editable;
|
|
279
|
+
const linesStartIndices = getSelectedLinesStartIndices();
|
|
280
|
+
let value = editable.value;
|
|
281
|
+
linesStartIndices.forEach((startIndex) => {
|
|
282
|
+
const startValue = value.slice(0, startIndex);
|
|
283
|
+
const endValue = value.slice(startIndex);
|
|
284
|
+
value = `${startValue}${TAB}${endValue}`;
|
|
285
|
+
});
|
|
286
|
+
editable.value = value;
|
|
287
|
+
editable.selectionStart = selectionStart + TAB_SIZE;
|
|
288
|
+
editable.selectionEnd = selectionEnd + TAB_SIZE * linesStartIndices.length;
|
|
289
|
+
};
|
|
290
|
+
const outdent = () => {
|
|
291
|
+
const { selectionStart, selectionEnd } = editable;
|
|
292
|
+
const linesStartIndices = getSelectedLinesStartIndices();
|
|
293
|
+
const removedTabs = [];
|
|
294
|
+
let value = editable.value;
|
|
295
|
+
linesStartIndices.forEach((startIndex) => {
|
|
296
|
+
const tabMatch = value
|
|
297
|
+
.slice(startIndex, startIndex + TAB_SIZE)
|
|
298
|
+
.match(RE_LEADING_TAB);
|
|
299
|
+
if (tabMatch) {
|
|
300
|
+
const startValue = value.slice(0, startIndex);
|
|
301
|
+
const endValue = value.slice(startIndex + tabMatch[0].length);
|
|
302
|
+
// Delete a tab from the line
|
|
303
|
+
value = `${startValue}${endValue}`;
|
|
304
|
+
removedTabs.push(startIndex);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
editable.value = value;
|
|
308
|
+
if (removedTabs.length) {
|
|
309
|
+
if (selectionStart > removedTabs[removedTabs.length - 1]) {
|
|
310
|
+
editable.selectionStart = Math.max(selectionStart - TAB_SIZE, removedTabs[removedTabs.length - 1]);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// If the cursor is before the first tab removed, ex:
|
|
314
|
+
// Line| #1
|
|
315
|
+
// Line #2
|
|
316
|
+
// Lin|e #3
|
|
317
|
+
// we should reset the selectionStart to his initial value.
|
|
318
|
+
editable.selectionStart = selectionStart;
|
|
319
|
+
}
|
|
320
|
+
editable.selectionEnd = Math.max(editable.selectionStart, selectionEnd - TAB_SIZE * removedTabs.length);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* @returns indices of start positions of selected lines, in reverse order
|
|
325
|
+
*/
|
|
326
|
+
const getSelectedLinesStartIndices = () => {
|
|
327
|
+
let { selectionStart, selectionEnd, value } = editable;
|
|
328
|
+
// chars before selectionStart on the same line
|
|
329
|
+
const startOffset = value.slice(0, selectionStart).match(/[^\n]*$/)[0]
|
|
330
|
+
.length;
|
|
331
|
+
// put caret at the start of the line
|
|
332
|
+
selectionStart = selectionStart - startOffset;
|
|
333
|
+
const selected = value.slice(selectionStart, selectionEnd);
|
|
334
|
+
return selected
|
|
335
|
+
.split("\n")
|
|
336
|
+
.reduce((startIndices, line, idx, lines) => startIndices.concat(idx
|
|
337
|
+
? // curr line index is prev line's start + prev line's length + \n
|
|
338
|
+
startIndices[idx - 1] + lines[idx - 1].length + 1
|
|
339
|
+
: // first selected line
|
|
340
|
+
selectionStart), [])
|
|
341
|
+
.reverse();
|
|
342
|
+
};
|
|
343
|
+
const stopEvent = (event) => {
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
event.stopPropagation();
|
|
346
|
+
};
|
|
347
|
+
// using a state variable instead of passing it to the handleSubmit callback
|
|
348
|
+
// so that we don't need to create separate a callback for event handlers
|
|
349
|
+
let submittedViaKeyboard = false;
|
|
350
|
+
const handleSubmit = () => {
|
|
351
|
+
// cleanup must be run before onSubmit otherwise when app blurs the wysiwyg
|
|
352
|
+
// it'd get stuck in an infinite loop of blur→onSubmit after we re-focus the
|
|
353
|
+
// wysiwyg on update
|
|
354
|
+
cleanup();
|
|
355
|
+
const updateElement = Scene.getScene(element)?.getElement(element.id);
|
|
356
|
+
if (!updateElement) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
let text = editable.value;
|
|
360
|
+
const container = getContainerElement(updateElement);
|
|
361
|
+
if (container) {
|
|
362
|
+
text = updateElement.text;
|
|
363
|
+
if (editable.value.trim()) {
|
|
364
|
+
const boundTextElementId = getBoundTextElementId(container);
|
|
365
|
+
if (!boundTextElementId || boundTextElementId !== element.id) {
|
|
366
|
+
mutateElement(container, {
|
|
367
|
+
boundElements: (container.boundElements || []).concat({
|
|
368
|
+
type: "text",
|
|
369
|
+
id: element.id,
|
|
370
|
+
}),
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
else if (isArrowElement(container)) {
|
|
374
|
+
// updating an arrow label may change bounds, prevent stale cache:
|
|
375
|
+
bumpVersion(container);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
mutateElement(container, {
|
|
380
|
+
boundElements: container.boundElements?.filter((ele) => !isTextElement(ele)),
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
redrawTextBoundingBox(updateElement, container);
|
|
384
|
+
}
|
|
385
|
+
onSubmit({
|
|
386
|
+
text,
|
|
387
|
+
viaKeyboard: submittedViaKeyboard,
|
|
388
|
+
originalText: editable.value,
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
const cleanup = () => {
|
|
392
|
+
if (isDestroyed) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
isDestroyed = true;
|
|
396
|
+
// remove events to ensure they don't late-fire
|
|
397
|
+
editable.onblur = null;
|
|
398
|
+
editable.oninput = null;
|
|
399
|
+
editable.onkeydown = null;
|
|
400
|
+
if (observer) {
|
|
401
|
+
observer.disconnect();
|
|
402
|
+
}
|
|
403
|
+
window.removeEventListener("resize", updateWysiwygStyle);
|
|
404
|
+
window.removeEventListener("wheel", stopEvent, true);
|
|
405
|
+
window.removeEventListener("pointerdown", onPointerDown);
|
|
406
|
+
window.removeEventListener("pointerup", bindBlurEvent);
|
|
407
|
+
window.removeEventListener("blur", handleSubmit);
|
|
408
|
+
window.removeEventListener("beforeunload", handleSubmit);
|
|
409
|
+
unbindUpdate();
|
|
410
|
+
editable.remove();
|
|
411
|
+
};
|
|
412
|
+
const bindBlurEvent = (event) => {
|
|
413
|
+
window.removeEventListener("pointerup", bindBlurEvent);
|
|
414
|
+
// Deferred so that the pointerdown that initiates the wysiwyg doesn't
|
|
415
|
+
// trigger the blur on ensuing pointerup.
|
|
416
|
+
// Also to handle cases such as picking a color which would trigger a blur
|
|
417
|
+
// in that same tick.
|
|
418
|
+
const target = event?.target;
|
|
419
|
+
const isTargetPickerTrigger = target instanceof HTMLElement &&
|
|
420
|
+
target.classList.contains("active-color");
|
|
421
|
+
setTimeout(() => {
|
|
422
|
+
editable.onblur = handleSubmit;
|
|
423
|
+
if (isTargetPickerTrigger) {
|
|
424
|
+
const callback = (mutationList, observer) => {
|
|
425
|
+
const radixIsRemoved = mutationList.find((mutation) => mutation.removedNodes.length > 0 &&
|
|
426
|
+
mutation.removedNodes[0].dataset
|
|
427
|
+
?.radixPopperContentWrapper !== undefined);
|
|
428
|
+
if (radixIsRemoved) {
|
|
429
|
+
// should work without this in theory
|
|
430
|
+
// and i think it does actually but radix probably somewhere,
|
|
431
|
+
// somehow sets the focus elsewhere
|
|
432
|
+
setTimeout(() => {
|
|
433
|
+
editable.focus();
|
|
434
|
+
});
|
|
435
|
+
observer.disconnect();
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
const observer = new MutationObserver(callback);
|
|
439
|
+
observer.observe(document.querySelector(".excalidraw-container"), {
|
|
440
|
+
childList: true,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
// case: clicking on the same property → no change → no update → no focus
|
|
444
|
+
if (!isTargetPickerTrigger) {
|
|
445
|
+
editable.focus();
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
// prevent blur when changing properties from the menu
|
|
450
|
+
const onPointerDown = (event) => {
|
|
451
|
+
const isTargetPickerTrigger = event.target instanceof HTMLElement &&
|
|
452
|
+
event.target.classList.contains("active-color");
|
|
453
|
+
if (((event.target instanceof HTMLElement ||
|
|
454
|
+
event.target instanceof SVGElement) &&
|
|
455
|
+
event.target.closest(`.${CLASSES.SHAPE_ACTIONS_MENU}`) &&
|
|
456
|
+
!isWritableElement(event.target)) ||
|
|
457
|
+
isTargetPickerTrigger) {
|
|
458
|
+
editable.onblur = null;
|
|
459
|
+
window.addEventListener("pointerup", bindBlurEvent);
|
|
460
|
+
// handle edge-case where pointerup doesn't fire e.g. due to user
|
|
461
|
+
// alt-tabbing away
|
|
462
|
+
window.addEventListener("blur", handleSubmit);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
// handle updates of textElement properties of editing element
|
|
466
|
+
const unbindUpdate = Scene.getScene(element).addCallback(() => {
|
|
467
|
+
updateWysiwygStyle();
|
|
468
|
+
const isColorPickerActive = !!document.activeElement?.closest(".color-picker-content");
|
|
469
|
+
if (!isColorPickerActive) {
|
|
470
|
+
editable.focus();
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
// ---------------------------------------------------------------------------
|
|
474
|
+
let isDestroyed = false;
|
|
475
|
+
// select on init (focusing is done separately inside the bindBlurEvent()
|
|
476
|
+
// because we need it to happen *after* the blur event from `pointerdown`)
|
|
477
|
+
editable.select();
|
|
478
|
+
bindBlurEvent();
|
|
479
|
+
// reposition wysiwyg in case of canvas is resized. Using ResizeObserver
|
|
480
|
+
// is preferred so we catch changes from host, where window may not resize.
|
|
481
|
+
let observer = null;
|
|
482
|
+
if (canvas && "ResizeObserver" in window) {
|
|
483
|
+
observer = new window.ResizeObserver(() => {
|
|
484
|
+
updateWysiwygStyle();
|
|
485
|
+
});
|
|
486
|
+
observer.observe(canvas);
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
window.addEventListener("resize", updateWysiwygStyle);
|
|
490
|
+
}
|
|
491
|
+
window.addEventListener("pointerdown", onPointerDown);
|
|
492
|
+
window.addEventListener("wheel", stopEvent, {
|
|
493
|
+
passive: false,
|
|
494
|
+
capture: true,
|
|
495
|
+
});
|
|
496
|
+
window.addEventListener("beforeunload", handleSubmit);
|
|
497
|
+
excalidrawContainer
|
|
498
|
+
?.querySelector(".excalidraw-textEditorContainer")
|
|
499
|
+
.appendChild(editable);
|
|
500
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { getElementAbsoluteCoords } from "./bounds";
|
|
2
|
+
import { rotate } from "../math";
|
|
3
|
+
import { isTextElement } from ".";
|
|
4
|
+
import { isFrameLikeElement, isLinearElement } from "./typeChecks";
|
|
5
|
+
import { DEFAULT_SPACING } from "../renderer/renderScene";
|
|
6
|
+
const transformHandleSizes = {
|
|
7
|
+
mouse: 8,
|
|
8
|
+
pen: 16,
|
|
9
|
+
touch: 28,
|
|
10
|
+
};
|
|
11
|
+
const ROTATION_RESIZE_HANDLE_GAP = 16;
|
|
12
|
+
export const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS = {
|
|
13
|
+
e: true,
|
|
14
|
+
s: true,
|
|
15
|
+
n: true,
|
|
16
|
+
w: true,
|
|
17
|
+
};
|
|
18
|
+
export const OMIT_SIDES_FOR_FRAME = {
|
|
19
|
+
e: true,
|
|
20
|
+
s: true,
|
|
21
|
+
n: true,
|
|
22
|
+
w: true,
|
|
23
|
+
rotation: true,
|
|
24
|
+
};
|
|
25
|
+
const OMIT_SIDES_FOR_TEXT_ELEMENT = {
|
|
26
|
+
e: true,
|
|
27
|
+
s: true,
|
|
28
|
+
n: true,
|
|
29
|
+
w: true,
|
|
30
|
+
};
|
|
31
|
+
const OMIT_SIDES_FOR_LINE_SLASH = {
|
|
32
|
+
e: true,
|
|
33
|
+
s: true,
|
|
34
|
+
n: true,
|
|
35
|
+
w: true,
|
|
36
|
+
nw: true,
|
|
37
|
+
se: true,
|
|
38
|
+
};
|
|
39
|
+
const OMIT_SIDES_FOR_LINE_BACKSLASH = {
|
|
40
|
+
e: true,
|
|
41
|
+
s: true,
|
|
42
|
+
n: true,
|
|
43
|
+
w: true,
|
|
44
|
+
};
|
|
45
|
+
const generateTransformHandle = (x, y, width, height, cx, cy, angle) => {
|
|
46
|
+
const [xx, yy] = rotate(x + width / 2, y + height / 2, cx, cy, angle);
|
|
47
|
+
return [xx - width / 2, yy - height / 2, width, height];
|
|
48
|
+
};
|
|
49
|
+
export const getTransformHandlesFromCoords = ([x1, y1, x2, y2, cx, cy], angle, zoom, pointerType, omitSides = {}, margin = 4) => {
|
|
50
|
+
const size = transformHandleSizes[pointerType];
|
|
51
|
+
const handleWidth = size / zoom.value;
|
|
52
|
+
const handleHeight = size / zoom.value;
|
|
53
|
+
const handleMarginX = size / zoom.value;
|
|
54
|
+
const handleMarginY = size / zoom.value;
|
|
55
|
+
const width = x2 - x1;
|
|
56
|
+
const height = y2 - y1;
|
|
57
|
+
const dashedLineMargin = margin / zoom.value;
|
|
58
|
+
const centeringOffset = (size - DEFAULT_SPACING * 2) / (2 * zoom.value);
|
|
59
|
+
const transformHandles = {
|
|
60
|
+
nw: omitSides.nw
|
|
61
|
+
? undefined
|
|
62
|
+
: generateTransformHandle(x1 - dashedLineMargin - handleMarginX + centeringOffset, y1 - dashedLineMargin - handleMarginY + centeringOffset, handleWidth, handleHeight, cx, cy, angle),
|
|
63
|
+
ne: omitSides.ne
|
|
64
|
+
? undefined
|
|
65
|
+
: generateTransformHandle(x2 + dashedLineMargin - centeringOffset, y1 - dashedLineMargin - handleMarginY + centeringOffset, handleWidth, handleHeight, cx, cy, angle),
|
|
66
|
+
sw: omitSides.sw
|
|
67
|
+
? undefined
|
|
68
|
+
: generateTransformHandle(x1 - dashedLineMargin - handleMarginX + centeringOffset, y2 + dashedLineMargin - centeringOffset, handleWidth, handleHeight, cx, cy, angle),
|
|
69
|
+
se: omitSides.se
|
|
70
|
+
? undefined
|
|
71
|
+
: generateTransformHandle(x2 + dashedLineMargin - centeringOffset, y2 + dashedLineMargin - centeringOffset, handleWidth, handleHeight, cx, cy, angle),
|
|
72
|
+
rotation: omitSides.rotation
|
|
73
|
+
? undefined
|
|
74
|
+
: generateTransformHandle(x1 + width / 2 - handleWidth / 2, y1 -
|
|
75
|
+
dashedLineMargin -
|
|
76
|
+
handleMarginY +
|
|
77
|
+
centeringOffset -
|
|
78
|
+
ROTATION_RESIZE_HANDLE_GAP / zoom.value, handleWidth, handleHeight, cx, cy, angle),
|
|
79
|
+
};
|
|
80
|
+
// We only want to show height handles (all cardinal directions) above a certain size
|
|
81
|
+
// Note: we render using "mouse" size so we should also use "mouse" size for this check
|
|
82
|
+
const minimumSizeForEightHandles = (5 * transformHandleSizes.mouse) / zoom.value;
|
|
83
|
+
if (Math.abs(width) > minimumSizeForEightHandles) {
|
|
84
|
+
if (!omitSides.n) {
|
|
85
|
+
transformHandles.n = generateTransformHandle(x1 + width / 2 - handleWidth / 2, y1 - dashedLineMargin - handleMarginY + centeringOffset, handleWidth, handleHeight, cx, cy, angle);
|
|
86
|
+
}
|
|
87
|
+
if (!omitSides.s) {
|
|
88
|
+
transformHandles.s = generateTransformHandle(x1 + width / 2 - handleWidth / 2, y2 + dashedLineMargin - centeringOffset, handleWidth, handleHeight, cx, cy, angle);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (Math.abs(height) > minimumSizeForEightHandles) {
|
|
92
|
+
if (!omitSides.w) {
|
|
93
|
+
transformHandles.w = generateTransformHandle(x1 - dashedLineMargin - handleMarginX + centeringOffset, y1 + height / 2 - handleHeight / 2, handleWidth, handleHeight, cx, cy, angle);
|
|
94
|
+
}
|
|
95
|
+
if (!omitSides.e) {
|
|
96
|
+
transformHandles.e = generateTransformHandle(x2 + dashedLineMargin - centeringOffset, y1 + height / 2 - handleHeight / 2, handleWidth, handleHeight, cx, cy, angle);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return transformHandles;
|
|
100
|
+
};
|
|
101
|
+
export const getTransformHandles = (element, zoom, pointerType = "mouse") => {
|
|
102
|
+
// so that when locked element is selected (especially when you toggle lock
|
|
103
|
+
// via keyboard) the locked element is visually distinct, indicating
|
|
104
|
+
// you can't move/resize
|
|
105
|
+
if (element.locked) {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
let omitSides = {};
|
|
109
|
+
if (element.type === "freedraw" || isLinearElement(element)) {
|
|
110
|
+
if (element.points.length === 2) {
|
|
111
|
+
// only check the last point because starting point is always (0,0)
|
|
112
|
+
const [, p1] = element.points;
|
|
113
|
+
if (p1[0] === 0 || p1[1] === 0) {
|
|
114
|
+
omitSides = OMIT_SIDES_FOR_LINE_BACKSLASH;
|
|
115
|
+
}
|
|
116
|
+
else if (p1[0] > 0 && p1[1] < 0) {
|
|
117
|
+
omitSides = OMIT_SIDES_FOR_LINE_SLASH;
|
|
118
|
+
}
|
|
119
|
+
else if (p1[0] > 0 && p1[1] > 0) {
|
|
120
|
+
omitSides = OMIT_SIDES_FOR_LINE_BACKSLASH;
|
|
121
|
+
}
|
|
122
|
+
else if (p1[0] < 0 && p1[1] > 0) {
|
|
123
|
+
omitSides = OMIT_SIDES_FOR_LINE_SLASH;
|
|
124
|
+
}
|
|
125
|
+
else if (p1[0] < 0 && p1[1] < 0) {
|
|
126
|
+
omitSides = OMIT_SIDES_FOR_LINE_BACKSLASH;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (isTextElement(element)) {
|
|
131
|
+
omitSides = OMIT_SIDES_FOR_TEXT_ELEMENT;
|
|
132
|
+
}
|
|
133
|
+
else if (isFrameLikeElement(element)) {
|
|
134
|
+
omitSides = {
|
|
135
|
+
rotation: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const dashedLineMargin = isLinearElement(element)
|
|
139
|
+
? DEFAULT_SPACING + 8
|
|
140
|
+
: DEFAULT_SPACING;
|
|
141
|
+
return getTransformHandlesFromCoords(getElementAbsoluteCoords(element, true), element.angle, zoom, pointerType, omitSides, dashedLineMargin);
|
|
142
|
+
};
|
|
143
|
+
export const shouldShowBoundingBox = (elements, appState) => {
|
|
144
|
+
if (appState.editingLinearElement) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
if (elements.length > 1) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
const element = elements[0];
|
|
151
|
+
if (!isLinearElement(element)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
return element.points.length > 2;
|
|
155
|
+
};
|