@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,351 @@
|
|
|
1
|
+
import { tryParseSpreadsheet, VALID_SPREADSHEET } from "./charts";
|
|
2
|
+
import { ALLOWED_PASTE_MIME_TYPES, EXPORT_DATA_TYPES, MIME_TYPES, } from "./constants";
|
|
3
|
+
import { isFrameLikeElement, isInitializedImageElement, } from "./element/typeChecks";
|
|
4
|
+
import { deepCopyElement } from "./element/newElement";
|
|
5
|
+
import { mutateElement } from "./element/mutateElement";
|
|
6
|
+
import { getContainingFrame } from "./frame";
|
|
7
|
+
import { isMemberOf, isPromiseLike } from "./utils";
|
|
8
|
+
import { t } from "./i18n";
|
|
9
|
+
export const probablySupportsClipboardReadText = "clipboard" in navigator && "readText" in navigator.clipboard;
|
|
10
|
+
export const probablySupportsClipboardWriteText = "clipboard" in navigator && "writeText" in navigator.clipboard;
|
|
11
|
+
export const probablySupportsClipboardBlob = "clipboard" in navigator &&
|
|
12
|
+
"write" in navigator.clipboard &&
|
|
13
|
+
"ClipboardItem" in window &&
|
|
14
|
+
"toBlob" in HTMLCanvasElement.prototype;
|
|
15
|
+
const clipboardContainsElements = (contents) => {
|
|
16
|
+
if ([
|
|
17
|
+
EXPORT_DATA_TYPES.excalidraw,
|
|
18
|
+
EXPORT_DATA_TYPES.excalidrawClipboard,
|
|
19
|
+
EXPORT_DATA_TYPES.excalidrawClipboardWithAPI,
|
|
20
|
+
].includes(contents?.type) &&
|
|
21
|
+
Array.isArray(contents.elements)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
export const createPasteEvent = ({ types, files, }) => {
|
|
27
|
+
if (!types && !files) {
|
|
28
|
+
console.warn("createPasteEvent: no types or files provided");
|
|
29
|
+
}
|
|
30
|
+
const event = new ClipboardEvent("paste", {
|
|
31
|
+
clipboardData: new DataTransfer(),
|
|
32
|
+
});
|
|
33
|
+
if (types) {
|
|
34
|
+
for (const [type, value] of Object.entries(types)) {
|
|
35
|
+
try {
|
|
36
|
+
event.clipboardData?.setData(type, value);
|
|
37
|
+
if (event.clipboardData?.getData(type) !== value) {
|
|
38
|
+
throw new Error(`Failed to set "${type}" as clipboardData item`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new Error(error.message);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (files) {
|
|
47
|
+
let idx = -1;
|
|
48
|
+
for (const file of files) {
|
|
49
|
+
idx++;
|
|
50
|
+
try {
|
|
51
|
+
event.clipboardData?.items.add(file);
|
|
52
|
+
if (event.clipboardData?.files[idx] !== file) {
|
|
53
|
+
throw new Error(`Failed to set file "${file.name}" as clipboardData item`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error(error.message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return event;
|
|
62
|
+
};
|
|
63
|
+
export const serializeAsClipboardJSON = ({ elements, files, }) => {
|
|
64
|
+
const framesToCopy = new Set(elements.filter((element) => isFrameLikeElement(element)));
|
|
65
|
+
let foundFile = false;
|
|
66
|
+
const _files = elements.reduce((acc, element) => {
|
|
67
|
+
if (isInitializedImageElement(element)) {
|
|
68
|
+
foundFile = true;
|
|
69
|
+
if (files && files[element.fileId]) {
|
|
70
|
+
acc[element.fileId] = files[element.fileId];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return acc;
|
|
74
|
+
}, {});
|
|
75
|
+
if (foundFile && !files) {
|
|
76
|
+
console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");
|
|
77
|
+
}
|
|
78
|
+
// select bound text elements when copying
|
|
79
|
+
const contents = {
|
|
80
|
+
type: EXPORT_DATA_TYPES.excalidrawClipboard,
|
|
81
|
+
elements: elements.map((element) => {
|
|
82
|
+
if (getContainingFrame(element) &&
|
|
83
|
+
!framesToCopy.has(getContainingFrame(element))) {
|
|
84
|
+
const copiedElement = deepCopyElement(element);
|
|
85
|
+
mutateElement(copiedElement, {
|
|
86
|
+
frameId: null,
|
|
87
|
+
});
|
|
88
|
+
return copiedElement;
|
|
89
|
+
}
|
|
90
|
+
return element;
|
|
91
|
+
}),
|
|
92
|
+
files: files ? _files : undefined,
|
|
93
|
+
};
|
|
94
|
+
return JSON.stringify(contents);
|
|
95
|
+
};
|
|
96
|
+
export const copyToClipboard = async (elements, files,
|
|
97
|
+
/** supply if available to make the operation more certain to succeed */
|
|
98
|
+
clipboardEvent) => {
|
|
99
|
+
await copyTextToSystemClipboard(serializeAsClipboardJSON({ elements, files }), clipboardEvent);
|
|
100
|
+
};
|
|
101
|
+
const parsePotentialSpreadsheet = (text) => {
|
|
102
|
+
const result = tryParseSpreadsheet(text);
|
|
103
|
+
if (result.type === VALID_SPREADSHEET) {
|
|
104
|
+
return { spreadsheet: result.spreadsheet };
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
108
|
+
/** internal, specific to parsing paste events. Do not reuse. */
|
|
109
|
+
function parseHTMLTree(el) {
|
|
110
|
+
let result = [];
|
|
111
|
+
for (const node of el.childNodes) {
|
|
112
|
+
if (node.nodeType === 3) {
|
|
113
|
+
const text = node.textContent?.trim();
|
|
114
|
+
if (text) {
|
|
115
|
+
result.push({ type: "text", value: text });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (node instanceof HTMLImageElement) {
|
|
119
|
+
const url = node.getAttribute("src");
|
|
120
|
+
if (url && url.startsWith("http")) {
|
|
121
|
+
result.push({ type: "imageUrl", value: url });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
result = result.concat(parseHTMLTree(node));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
const maybeParseHTMLPaste = (event) => {
|
|
131
|
+
const html = event.clipboardData?.getData("text/html");
|
|
132
|
+
if (!html) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
137
|
+
const content = parseHTMLTree(doc.body);
|
|
138
|
+
if (content.length) {
|
|
139
|
+
return { type: "mixedContent", value: content };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
console.error(`error in parseHTMLFromPaste: ${error.message}`);
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
export const readSystemClipboard = async () => {
|
|
148
|
+
const types = {};
|
|
149
|
+
try {
|
|
150
|
+
if (navigator.clipboard?.readText) {
|
|
151
|
+
return { "text/plain": await navigator.clipboard?.readText() };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
if (navigator.clipboard?.read) {
|
|
157
|
+
console.warn(`navigator.clipboard.readText() failed (${error.message}). Failling back to navigator.clipboard.read()`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
let clipboardItems;
|
|
164
|
+
try {
|
|
165
|
+
clipboardItems = await navigator.clipboard?.read();
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (error.name === "DataError") {
|
|
169
|
+
console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${error.message}`);
|
|
170
|
+
return types;
|
|
171
|
+
}
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
for (const item of clipboardItems) {
|
|
175
|
+
for (const type of item.types) {
|
|
176
|
+
if (!isMemberOf(ALLOWED_PASTE_MIME_TYPES, type)) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
types[type] = await (await item.getType(type)).text();
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.warn(`Cannot retrieve ${type} from clipboardItem: ${error.message}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (Object.keys(types).length === 0) {
|
|
188
|
+
console.warn("No clipboard data found from clipboard.read().");
|
|
189
|
+
return types;
|
|
190
|
+
}
|
|
191
|
+
return types;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Parses "paste" ClipboardEvent.
|
|
195
|
+
*/
|
|
196
|
+
const parseClipboardEvent = async (event, isPlainPaste = false) => {
|
|
197
|
+
try {
|
|
198
|
+
const mixedContent = !isPlainPaste && event && maybeParseHTMLPaste(event);
|
|
199
|
+
if (mixedContent) {
|
|
200
|
+
if (mixedContent.value.every((item) => item.type === "text")) {
|
|
201
|
+
return {
|
|
202
|
+
type: "text",
|
|
203
|
+
value: event.clipboardData?.getData("text/plain") ||
|
|
204
|
+
mixedContent.value
|
|
205
|
+
.map((item) => item.value)
|
|
206
|
+
.join("\n")
|
|
207
|
+
.trim(),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return mixedContent;
|
|
211
|
+
}
|
|
212
|
+
const text = event.clipboardData?.getData("text/plain");
|
|
213
|
+
return { type: "text", value: (text || "").trim() };
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return { type: "text", value: "" };
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Attempts to parse clipboard. Prefers system clipboard.
|
|
221
|
+
*/
|
|
222
|
+
export const parseClipboard = async (event, isPlainPaste = false) => {
|
|
223
|
+
const parsedEventData = await parseClipboardEvent(event, isPlainPaste);
|
|
224
|
+
if (parsedEventData.type === "mixedContent") {
|
|
225
|
+
return {
|
|
226
|
+
mixedContent: parsedEventData.value,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
// if system clipboard contains spreadsheet, use it even though it's
|
|
231
|
+
// technically possible it's staler than in-app clipboard
|
|
232
|
+
const spreadsheetResult = !isPlainPaste && parsePotentialSpreadsheet(parsedEventData.value);
|
|
233
|
+
if (spreadsheetResult) {
|
|
234
|
+
return spreadsheetResult;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error(error);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
const systemClipboardData = JSON.parse(parsedEventData.value);
|
|
242
|
+
const programmaticAPI = systemClipboardData.type === EXPORT_DATA_TYPES.excalidrawClipboardWithAPI;
|
|
243
|
+
if (clipboardContainsElements(systemClipboardData)) {
|
|
244
|
+
return {
|
|
245
|
+
elements: systemClipboardData.elements,
|
|
246
|
+
files: systemClipboardData.files,
|
|
247
|
+
text: isPlainPaste
|
|
248
|
+
? JSON.stringify(systemClipboardData.elements, null, 2)
|
|
249
|
+
: undefined,
|
|
250
|
+
programmaticAPI,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch { }
|
|
255
|
+
return { text: parsedEventData.value };
|
|
256
|
+
};
|
|
257
|
+
export const copyBlobToClipboardAsPng = async (blob) => {
|
|
258
|
+
try {
|
|
259
|
+
// in Safari so far we need to construct the ClipboardItem synchronously
|
|
260
|
+
// (i.e. in the same tick) otherwise browser will complain for lack of
|
|
261
|
+
// user intent. Using a Promise ClipboardItem constructor solves this.
|
|
262
|
+
// https://bugs.webkit.org/show_bug.cgi?id=222262
|
|
263
|
+
//
|
|
264
|
+
// Note that Firefox (and potentially others) seems to support Promise
|
|
265
|
+
// ClipboardItem constructor, but throws on an unrelated MIME type error.
|
|
266
|
+
// So we need to await this and fallback to awaiting the blob if applicable.
|
|
267
|
+
await navigator.clipboard.write([
|
|
268
|
+
new window.ClipboardItem({
|
|
269
|
+
[MIME_TYPES.png]: blob,
|
|
270
|
+
}),
|
|
271
|
+
]);
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
// if we're using a Promise ClipboardItem, let's try constructing
|
|
275
|
+
// with resolution value instead
|
|
276
|
+
if (isPromiseLike(blob)) {
|
|
277
|
+
await navigator.clipboard.write([
|
|
278
|
+
new window.ClipboardItem({
|
|
279
|
+
[MIME_TYPES.png]: await blob,
|
|
280
|
+
}),
|
|
281
|
+
]);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
throw error;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
export const copyTextToSystemClipboard = async (text, clipboardEvent) => {
|
|
289
|
+
// (1) first try using Async Clipboard API
|
|
290
|
+
if (probablySupportsClipboardWriteText) {
|
|
291
|
+
try {
|
|
292
|
+
// NOTE: doesn't work on FF on non-HTTPS domains, or when document
|
|
293
|
+
// not focused
|
|
294
|
+
await navigator.clipboard.writeText(text || "");
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
console.error(error);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// (2) if fails and we have access to ClipboardEvent, use plain old setData()
|
|
302
|
+
try {
|
|
303
|
+
if (clipboardEvent) {
|
|
304
|
+
clipboardEvent.clipboardData?.setData("text/plain", text || "");
|
|
305
|
+
if (clipboardEvent.clipboardData?.getData("text/plain") !== text) {
|
|
306
|
+
throw new Error("Failed to setData on clipboardEvent");
|
|
307
|
+
}
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
console.error(error);
|
|
313
|
+
}
|
|
314
|
+
// (3) if that fails, use document.execCommand
|
|
315
|
+
if (!copyTextViaExecCommand(text)) {
|
|
316
|
+
throw new Error(t("errors.copyToSystemClipboardFailed"));
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
// adapted from https://github.com/zenorocha/clipboard.js/blob/ce79f170aa655c408b6aab33c9472e8e4fa52e19/src/clipboard-action.js#L48
|
|
320
|
+
const copyTextViaExecCommand = (text) => {
|
|
321
|
+
// execCommand doesn't allow copying empty strings, so if we're
|
|
322
|
+
// clearing clipboard using this API, we must copy at least an empty char
|
|
323
|
+
if (!text) {
|
|
324
|
+
text = " ";
|
|
325
|
+
}
|
|
326
|
+
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
|
|
327
|
+
const textarea = document.createElement("textarea");
|
|
328
|
+
textarea.style.border = "0";
|
|
329
|
+
textarea.style.padding = "0";
|
|
330
|
+
textarea.style.margin = "0";
|
|
331
|
+
textarea.style.position = "absolute";
|
|
332
|
+
textarea.style[isRTL ? "right" : "left"] = "-9999px";
|
|
333
|
+
const yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
334
|
+
textarea.style.top = `${yPosition}px`;
|
|
335
|
+
// Prevent zooming on iOS
|
|
336
|
+
textarea.style.fontSize = "12pt";
|
|
337
|
+
textarea.setAttribute("readonly", "");
|
|
338
|
+
textarea.value = text;
|
|
339
|
+
document.body.appendChild(textarea);
|
|
340
|
+
let success = false;
|
|
341
|
+
try {
|
|
342
|
+
textarea.select();
|
|
343
|
+
textarea.setSelectionRange(0, textarea.value.length);
|
|
344
|
+
success = document.execCommand("copy");
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
console.error(error);
|
|
348
|
+
}
|
|
349
|
+
textarea.remove();
|
|
350
|
+
return success;
|
|
351
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import oc from "open-color";
|
|
2
|
+
// FIXME can't put to utils.ts rn because of circular dependency
|
|
3
|
+
const pick = (source, keys) => {
|
|
4
|
+
return keys.reduce((acc, key) => {
|
|
5
|
+
if (key in source) {
|
|
6
|
+
acc[key] = source[key];
|
|
7
|
+
}
|
|
8
|
+
return acc;
|
|
9
|
+
}, {});
|
|
10
|
+
};
|
|
11
|
+
export const MAX_CUSTOM_COLORS_USED_IN_CANVAS = 5;
|
|
12
|
+
export const COLORS_PER_ROW = 5;
|
|
13
|
+
export const DEFAULT_CHART_COLOR_INDEX = 4;
|
|
14
|
+
export const DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
|
|
15
|
+
export const DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
|
|
16
|
+
export const ELEMENTS_PALETTE_SHADE_INDEXES = [0, 2, 4, 6, 8];
|
|
17
|
+
export const CANVAS_PALETTE_SHADE_INDEXES = [0, 1, 2, 3, 4];
|
|
18
|
+
export const getSpecificColorShades = (color, indexArr) => {
|
|
19
|
+
return indexArr.map((index) => oc[color][index]);
|
|
20
|
+
};
|
|
21
|
+
export const COLOR_PALETTE = {
|
|
22
|
+
transparent: "transparent",
|
|
23
|
+
black: "#1e1e1e",
|
|
24
|
+
white: "#ffffff",
|
|
25
|
+
// open-colors
|
|
26
|
+
gray: getSpecificColorShades("gray", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
27
|
+
red: getSpecificColorShades("red", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
28
|
+
pink: getSpecificColorShades("pink", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
29
|
+
grape: getSpecificColorShades("grape", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
30
|
+
violet: getSpecificColorShades("violet", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
31
|
+
blue: getSpecificColorShades("blue", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
32
|
+
cyan: getSpecificColorShades("cyan", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
33
|
+
teal: getSpecificColorShades("teal", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
34
|
+
green: getSpecificColorShades("green", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
35
|
+
yellow: getSpecificColorShades("yellow", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
36
|
+
orange: getSpecificColorShades("orange", ELEMENTS_PALETTE_SHADE_INDEXES),
|
|
37
|
+
// radix bronze shades 3,5,7,9,11
|
|
38
|
+
bronze: ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"],
|
|
39
|
+
};
|
|
40
|
+
const COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
41
|
+
"cyan",
|
|
42
|
+
"blue",
|
|
43
|
+
"violet",
|
|
44
|
+
"grape",
|
|
45
|
+
"pink",
|
|
46
|
+
"green",
|
|
47
|
+
"teal",
|
|
48
|
+
"yellow",
|
|
49
|
+
"orange",
|
|
50
|
+
"red",
|
|
51
|
+
]);
|
|
52
|
+
// -----------------------------------------------------------------------------
|
|
53
|
+
// quick picks defaults
|
|
54
|
+
// -----------------------------------------------------------------------------
|
|
55
|
+
// ORDER matters for positioning in quick picker
|
|
56
|
+
export const DEFAULT_ELEMENT_STROKE_PICKS = [
|
|
57
|
+
COLOR_PALETTE.black,
|
|
58
|
+
COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
59
|
+
COLOR_PALETTE.green[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
60
|
+
COLOR_PALETTE.blue[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
61
|
+
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
62
|
+
];
|
|
63
|
+
// ORDER matters for positioning in quick picker
|
|
64
|
+
export const DEFAULT_ELEMENT_BACKGROUND_PICKS = [
|
|
65
|
+
COLOR_PALETTE.transparent,
|
|
66
|
+
COLOR_PALETTE.red[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
67
|
+
COLOR_PALETTE.green[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
68
|
+
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
69
|
+
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
70
|
+
];
|
|
71
|
+
// ORDER matters for positioning in quick picker
|
|
72
|
+
export const DEFAULT_CANVAS_BACKGROUND_PICKS = [
|
|
73
|
+
COLOR_PALETTE.white,
|
|
74
|
+
// radix slate2
|
|
75
|
+
"#f8f9fa",
|
|
76
|
+
// radix blue2
|
|
77
|
+
"#f5faff",
|
|
78
|
+
// radix yellow2
|
|
79
|
+
"#fffce8",
|
|
80
|
+
// radix bronze2
|
|
81
|
+
"#fdf8f6",
|
|
82
|
+
];
|
|
83
|
+
// -----------------------------------------------------------------------------
|
|
84
|
+
// palette defaults
|
|
85
|
+
// -----------------------------------------------------------------------------
|
|
86
|
+
export const DEFAULT_ELEMENT_STROKE_COLOR_PALETTE = {
|
|
87
|
+
// 1st row
|
|
88
|
+
transparent: COLOR_PALETTE.transparent,
|
|
89
|
+
white: COLOR_PALETTE.white,
|
|
90
|
+
gray: COLOR_PALETTE.gray,
|
|
91
|
+
black: COLOR_PALETTE.black,
|
|
92
|
+
bronze: COLOR_PALETTE.bronze,
|
|
93
|
+
// rest
|
|
94
|
+
...COMMON_ELEMENT_SHADES,
|
|
95
|
+
};
|
|
96
|
+
// ORDER matters for positioning in pallete (5x3 grid)s
|
|
97
|
+
export const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE = {
|
|
98
|
+
transparent: COLOR_PALETTE.transparent,
|
|
99
|
+
white: COLOR_PALETTE.white,
|
|
100
|
+
gray: COLOR_PALETTE.gray,
|
|
101
|
+
black: COLOR_PALETTE.black,
|
|
102
|
+
bronze: COLOR_PALETTE.bronze,
|
|
103
|
+
...COMMON_ELEMENT_SHADES,
|
|
104
|
+
};
|
|
105
|
+
// -----------------------------------------------------------------------------
|
|
106
|
+
// helpers
|
|
107
|
+
// -----------------------------------------------------------------------------
|
|
108
|
+
// !!!MUST BE WITHOUT GRAY, TRANSPARENT AND BLACK!!!
|
|
109
|
+
export const getAllColorsSpecificShade = (index) => [
|
|
110
|
+
// 2nd row
|
|
111
|
+
COLOR_PALETTE.cyan[index],
|
|
112
|
+
COLOR_PALETTE.blue[index],
|
|
113
|
+
COLOR_PALETTE.violet[index],
|
|
114
|
+
COLOR_PALETTE.grape[index],
|
|
115
|
+
COLOR_PALETTE.pink[index],
|
|
116
|
+
// 3rd row
|
|
117
|
+
COLOR_PALETTE.green[index],
|
|
118
|
+
COLOR_PALETTE.teal[index],
|
|
119
|
+
COLOR_PALETTE.yellow[index],
|
|
120
|
+
COLOR_PALETTE.orange[index],
|
|
121
|
+
COLOR_PALETTE.red[index],
|
|
122
|
+
];
|
|
123
|
+
export const rgbToHex = (r, g, b) => `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
|
124
|
+
// -----------------------------------------------------------------------------
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { getNonDeletedElements } from "../element";
|
|
4
|
+
import { t } from "../i18n";
|
|
5
|
+
import { useDevice } from "./App";
|
|
6
|
+
import { canChangeRoundness, canHaveArrowheads, getTargetElements, hasBackground, hasStrokeStyle, hasStrokeWidth, } from "../scene";
|
|
7
|
+
import { SHAPES } from "../shapes";
|
|
8
|
+
import { capitalizeString, isTransparent } from "../utils";
|
|
9
|
+
import Stack from "./Stack";
|
|
10
|
+
import { ToolButton } from "./ToolButton";
|
|
11
|
+
import { hasStrokeColor } from "../scene/comparisons";
|
|
12
|
+
import { trackEvent } from "../analytics";
|
|
13
|
+
import { hasBoundTextElement, isTextElement } from "../element/typeChecks";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import { actionToggleZenMode } from "../actions";
|
|
16
|
+
import { Tooltip } from "./Tooltip";
|
|
17
|
+
import { shouldAllowVerticalAlign, suppportsHorizontalAlign, } from "../element/textElement";
|
|
18
|
+
import "./Actions.scss";
|
|
19
|
+
import DropdownMenu from "./dropdownMenu/DropdownMenu";
|
|
20
|
+
import { EmbedIcon, extraToolsIcon, frameToolIcon, mermaidLogoIcon, laserPointerToolIcon, OpenAIIcon, MagicIcon, } from "./icons";
|
|
21
|
+
import { KEYS } from "../keys";
|
|
22
|
+
import { useTunnels } from "../context/tunnels";
|
|
23
|
+
export const SelectedShapeActions = ({ appState, elements, renderAction, }) => {
|
|
24
|
+
const targetElements = getTargetElements(getNonDeletedElements(elements), appState);
|
|
25
|
+
let isSingleElementBoundContainer = false;
|
|
26
|
+
if (targetElements.length === 2 &&
|
|
27
|
+
(hasBoundTextElement(targetElements[0]) ||
|
|
28
|
+
hasBoundTextElement(targetElements[1]))) {
|
|
29
|
+
isSingleElementBoundContainer = true;
|
|
30
|
+
}
|
|
31
|
+
const isEditing = Boolean(appState.editingElement);
|
|
32
|
+
const device = useDevice();
|
|
33
|
+
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
|
|
34
|
+
const showFillIcons = (hasBackground(appState.activeTool.type) &&
|
|
35
|
+
!isTransparent(appState.currentItemBackgroundColor)) ||
|
|
36
|
+
targetElements.some((element) => hasBackground(element.type) && !isTransparent(element.backgroundColor));
|
|
37
|
+
const showChangeBackgroundIcons = hasBackground(appState.activeTool.type) ||
|
|
38
|
+
targetElements.some((element) => hasBackground(element.type));
|
|
39
|
+
const showLinkIcon = targetElements.length === 1 || isSingleElementBoundContainer;
|
|
40
|
+
let commonSelectedType = targetElements[0]?.type || null;
|
|
41
|
+
for (const element of targetElements) {
|
|
42
|
+
if (element.type !== commonSelectedType) {
|
|
43
|
+
commonSelectedType = null;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return (_jsxs("div", { className: "panelColumn", children: [_jsx("div", { children: ((hasStrokeColor(appState.activeTool.type) &&
|
|
48
|
+
appState.activeTool.type !== "image" &&
|
|
49
|
+
commonSelectedType !== "image" &&
|
|
50
|
+
commonSelectedType !== "frame" &&
|
|
51
|
+
commonSelectedType !== "magicframe") ||
|
|
52
|
+
targetElements.some((element) => hasStrokeColor(element.type))) &&
|
|
53
|
+
renderAction("changeStrokeColor") }), showChangeBackgroundIcons && (_jsx("div", { children: renderAction("changeBackgroundColor") })), showFillIcons && renderAction("changeFillStyle"), (hasStrokeWidth(appState.activeTool.type) ||
|
|
54
|
+
targetElements.some((element) => hasStrokeWidth(element.type))) &&
|
|
55
|
+
renderAction("changeStrokeWidth"), (appState.activeTool.type === "freedraw" ||
|
|
56
|
+
targetElements.some((element) => element.type === "freedraw")) &&
|
|
57
|
+
renderAction("changeStrokeShape"), (hasStrokeStyle(appState.activeTool.type) ||
|
|
58
|
+
targetElements.some((element) => hasStrokeStyle(element.type))) && (_jsxs(_Fragment, { children: [renderAction("changeStrokeStyle"), renderAction("changeSloppiness")] })), (canChangeRoundness(appState.activeTool.type) ||
|
|
59
|
+
targetElements.some((element) => canChangeRoundness(element.type))) && (_jsx(_Fragment, { children: renderAction("changeRoundness") })), (appState.activeTool.type === "text" ||
|
|
60
|
+
targetElements.some(isTextElement)) && (_jsxs(_Fragment, { children: [renderAction("changeFontSize"), renderAction("changeFontFamily"), (appState.activeTool.type === "text" ||
|
|
61
|
+
suppportsHorizontalAlign(targetElements)) &&
|
|
62
|
+
renderAction("changeTextAlign")] })), shouldAllowVerticalAlign(targetElements) &&
|
|
63
|
+
renderAction("changeVerticalAlign"), (canHaveArrowheads(appState.activeTool.type) ||
|
|
64
|
+
targetElements.some((element) => canHaveArrowheads(element.type))) && (_jsx(_Fragment, { children: renderAction("changeArrowhead") })), renderAction("changeOpacity"), _jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.layers") }), _jsxs("div", { className: "buttonList", children: [renderAction("sendToBack"), renderAction("sendBackward"), renderAction("bringToFront"), renderAction("bringForward")] })] }), targetElements.length > 1 && !isSingleElementBoundContainer && (_jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.align") }), _jsxs("div", { className: "buttonList", children: [isRTL ? (_jsxs(_Fragment, { children: [renderAction("alignRight"), renderAction("alignHorizontallyCentered"), renderAction("alignLeft")] })) : (_jsxs(_Fragment, { children: [renderAction("alignLeft"), renderAction("alignHorizontallyCentered"), renderAction("alignRight")] })), targetElements.length > 2 &&
|
|
65
|
+
renderAction("distributeHorizontally"), _jsx("div", { style: { flexBasis: "100%", height: 0 } }), _jsxs("div", { style: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
flexWrap: "wrap",
|
|
68
|
+
gap: ".5rem",
|
|
69
|
+
marginTop: "-0.5rem",
|
|
70
|
+
}, children: [renderAction("alignTop"), renderAction("alignVerticallyCentered"), renderAction("alignBottom"), targetElements.length > 2 &&
|
|
71
|
+
renderAction("distributeVertically")] })] })] })), !isEditing && targetElements.length > 0 && (_jsxs("fieldset", { children: [_jsx("legend", { children: t("labels.actions") }), _jsxs("div", { className: "buttonList", children: [!device.editor.isMobile && renderAction("duplicateSelection"), !device.editor.isMobile && renderAction("deleteSelectedElements"), renderAction("group"), renderAction("ungroup"), showLinkIcon && renderAction("hyperlink")] })] }))] }));
|
|
72
|
+
};
|
|
73
|
+
export const ShapesSwitcher = ({ activeTool, appState, app, UIOptions, }) => {
|
|
74
|
+
const [isExtraToolsMenuOpen, setIsExtraToolsMenuOpen] = useState(false);
|
|
75
|
+
const frameToolSelected = activeTool.type === "frame";
|
|
76
|
+
const laserToolSelected = activeTool.type === "laser";
|
|
77
|
+
const embeddableToolSelected = activeTool.type === "embeddable";
|
|
78
|
+
const { TTDDialogTriggerTunnel } = useTunnels();
|
|
79
|
+
return (_jsxs(_Fragment, { children: [SHAPES.map(({ value, icon, key, numericKey, fillable }, index) => {
|
|
80
|
+
if (UIOptions.tools?.[value] === false) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const label = t(`toolBar.${value}`);
|
|
84
|
+
const letter = key && capitalizeString(typeof key === "string" ? key : key[0]);
|
|
85
|
+
const shortcut = letter
|
|
86
|
+
? `${letter} ${t("helpDialog.or")} ${numericKey}`
|
|
87
|
+
: `${numericKey}`;
|
|
88
|
+
return (_jsx(ToolButton, { className: clsx("Shape", { fillable }), type: "radio", icon: icon, checked: activeTool.type === value, name: "editor-current-shape", title: `${capitalizeString(label)} — ${shortcut}`, keyBindingLabel: numericKey || letter, "aria-label": capitalizeString(label), "aria-keyshortcuts": shortcut, "data-testid": `toolbar-${value}`, onPointerDown: ({ pointerType }) => {
|
|
89
|
+
if (!appState.penDetected && pointerType === "pen") {
|
|
90
|
+
app.togglePenMode(true);
|
|
91
|
+
}
|
|
92
|
+
}, onChange: ({ pointerType }) => {
|
|
93
|
+
if (appState.activeTool.type !== value) {
|
|
94
|
+
trackEvent("toolbar", value, "ui");
|
|
95
|
+
}
|
|
96
|
+
if (value === "image") {
|
|
97
|
+
app.setActiveTool({
|
|
98
|
+
type: value,
|
|
99
|
+
insertOnCanvasDirectly: pointerType !== "mouse",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
app.setActiveTool({ type: value });
|
|
104
|
+
}
|
|
105
|
+
} }, value));
|
|
106
|
+
}), _jsx("div", { className: "App-toolbar__divider" }), _jsxs(DropdownMenu, { open: isExtraToolsMenuOpen, children: [_jsx(DropdownMenu.Trigger, { className: clsx("App-toolbar__extra-tools-trigger", {
|
|
107
|
+
"App-toolbar__extra-tools-trigger--selected": frameToolSelected ||
|
|
108
|
+
embeddableToolSelected ||
|
|
109
|
+
// in collab we're already highlighting the laser button
|
|
110
|
+
// outside toolbar, so let's not highlight extra-tools button
|
|
111
|
+
// on top of it
|
|
112
|
+
(laserToolSelected && !app.props.isCollaborating),
|
|
113
|
+
}), onToggle: () => setIsExtraToolsMenuOpen(!isExtraToolsMenuOpen), title: t("toolBar.extraTools"), children: extraToolsIcon }), _jsxs(DropdownMenu.Content, { onClickOutside: () => setIsExtraToolsMenuOpen(false), onSelect: () => setIsExtraToolsMenuOpen(false), className: "App-toolbar__extra-tools-dropdown", children: [_jsx(DropdownMenu.Item, { onSelect: () => app.setActiveTool({ type: "frame" }), icon: frameToolIcon, shortcut: KEYS.F.toLocaleUpperCase(), "data-testid": "toolbar-frame", selected: frameToolSelected, children: t("toolBar.frame") }), _jsx(DropdownMenu.Item, { onSelect: () => app.setActiveTool({ type: "embeddable" }), icon: EmbedIcon, "data-testid": "toolbar-embeddable", selected: embeddableToolSelected, children: t("toolBar.embeddable") }), _jsx(DropdownMenu.Item, { onSelect: () => app.setActiveTool({ type: "laser" }), icon: laserPointerToolIcon, "data-testid": "toolbar-laser", selected: laserToolSelected, shortcut: KEYS.K.toLocaleUpperCase(), children: t("toolBar.laser") }), _jsx("div", { style: { margin: "6px 0", fontSize: 14, fontWeight: 600 }, children: "Generate" }), app.props.aiEnabled !== false && _jsx(TTDDialogTriggerTunnel.Out, {}), _jsx(DropdownMenu.Item, { onSelect: () => app.setOpenDialog({ name: "ttd", tab: "mermaid" }), icon: mermaidLogoIcon, "data-testid": "toolbar-embeddable", children: t("toolBar.mermaidToExcalidraw") }), app.props.aiEnabled !== false && (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu.Item, { onSelect: () => app.onMagicframeToolSelect(), icon: MagicIcon, "data-testid": "toolbar-magicframe", children: [t("toolBar.magicframe"), _jsx(DropdownMenu.Item.Badge, { children: "AI" })] }), _jsx(DropdownMenu.Item, { onSelect: () => {
|
|
114
|
+
trackEvent("ai", "open-settings", "d2c");
|
|
115
|
+
app.setOpenDialog({
|
|
116
|
+
name: "settings",
|
|
117
|
+
source: "settings",
|
|
118
|
+
tab: "diagram-to-code",
|
|
119
|
+
});
|
|
120
|
+
}, icon: OpenAIIcon, "data-testid": "toolbar-magicSettings", children: t("toolBar.magicSettings") })] }))] })] })] }));
|
|
121
|
+
};
|
|
122
|
+
export const ZoomActions = ({ renderAction, zoom, }) => (_jsx(Stack.Col, { gap: 1, className: "zoom-actions", children: _jsxs(Stack.Row, { align: "center", children: [renderAction("zoomOut"), renderAction("resetZoom"), renderAction("zoomIn")] }) }));
|
|
123
|
+
export const UndoRedoActions = ({ renderAction, className, }) => (_jsxs("div", { className: `undo-redo-buttons ${className}`, children: [_jsx("div", { className: "undo-button-container", children: _jsx(Tooltip, { label: t("buttons.undo"), children: renderAction("undo") }) }), _jsx("div", { className: "redo-button-container", children: _jsxs(Tooltip, { label: t("buttons.redo"), children: [" ", renderAction("redo")] }) })] }));
|
|
124
|
+
export const ExitZenModeAction = ({ actionManager, showExitZenModeBtn, }) => (_jsx("button", { className: clsx("disable-zen-mode", {
|
|
125
|
+
"disable-zen-mode--visible": showExitZenModeBtn,
|
|
126
|
+
}), onClick: () => actionManager.executeAction(actionToggleZenMode), children: t("buttons.exitZenMode") }));
|
|
127
|
+
export const FinalizeAction = ({ renderAction, className, }) => (_jsx("div", { className: `finalize-button ${className}`, children: renderAction("finalize", { size: "small" }) }));
|