@excalidraw/excalidraw 0.17.1-88812e0 → 0.17.1-96eeec5
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/CHANGELOG.md +2 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-47LVF2XL.js → chunk-DEYXWPUO.js} +4933 -1520
- package/dist/browser/dev/excalidraw-assets-dev/chunk-DEYXWPUO.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-XOM7LNOU.js → chunk-EM6LVGFW.js} +27 -4
- package/dist/browser/dev/excalidraw-assets-dev/chunk-EM6LVGFW.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{dist-ITJNUBZF.js → dist-6QVAH5JA.js} +36 -14
- package/dist/browser/dev/excalidraw-assets-dev/dist-6QVAH5JA.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js → en-AZFA5HJJ.js} +4 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-LHMGJWTI.js → image-5XCR4WHS.js} +2 -2
- package/dist/browser/dev/index.css +157 -62
- package/dist/browser/dev/index.css.map +3 -3
- package/dist/browser/dev/index.js +12016 -7663
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/{chunk-5SYIAZGL.js → chunk-7DXALCB2.js} +5 -5
- package/dist/browser/prod/excalidraw-assets/chunk-ODWTVSS7.js +68 -0
- package/dist/browser/prod/excalidraw-assets/dist-567JAXHK.js +7 -0
- package/dist/browser/prod/excalidraw-assets/en-6E7MYLWO.js +1 -0
- package/dist/browser/prod/excalidraw-assets/image-LQAMCFQI.js +1 -0
- package/dist/browser/prod/index.css +1 -1
- package/dist/browser/prod/index.js +69 -51
- package/dist/dev/{en-XW4JO6VX.json → en-EB2MBPAV.json} +24 -3
- package/dist/dev/index.css +157 -62
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +18250 -16114
- package/dist/dev/index.js.map +4 -4
- package/dist/excalidraw/actions/actionAddToLibrary.d.ts +15 -6
- package/dist/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/excalidraw/actions/actionBoundText.d.ts +14 -8
- package/dist/excalidraw/actions/actionBoundText.js +3 -1
- package/dist/excalidraw/actions/actionCanvas.d.ts +64 -28
- package/dist/excalidraw/actions/actionCanvas.js +1 -1
- package/dist/excalidraw/actions/actionClipboard.d.ts +40 -19
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +17 -8
- package/dist/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +3 -3
- package/dist/excalidraw/actions/actionElementLock.d.ts +11 -5
- package/dist/excalidraw/actions/actionExport.d.ts +48 -21
- package/dist/excalidraw/actions/actionFinalize.d.ts +11 -5
- package/dist/excalidraw/actions/actionFinalize.js +1 -1
- package/dist/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/excalidraw/actions/actionFlip.js +5 -6
- package/dist/excalidraw/actions/actionFrame.d.ts +328 -8
- package/dist/excalidraw/actions/actionGroup.d.ts +320 -4
- package/dist/excalidraw/actions/actionHistory.d.ts +3 -3
- package/dist/excalidraw/actions/actionHistory.js +4 -4
- package/dist/excalidraw/actions/actionLinearEditor.d.ts +9 -4
- package/dist/excalidraw/actions/actionLinearEditor.js +19 -4
- package/dist/excalidraw/actions/actionLink.d.ts +5 -2
- package/dist/excalidraw/actions/actionMenu.d.ts +15 -6
- package/dist/excalidraw/actions/actionNavigate.d.ts +11 -5
- package/dist/excalidraw/actions/actionProperties.d.ts +67 -28
- package/dist/excalidraw/actions/actionProperties.js +1 -1
- package/dist/excalidraw/actions/actionSelectAll.d.ts +6 -3
- package/dist/excalidraw/actions/actionStyles.d.ts +9 -3
- package/dist/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
- package/dist/excalidraw/actions/actionTextAutoResize.js +38 -0
- package/dist/excalidraw/actions/actionToggleGridMode.d.ts +6 -3
- package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
- package/dist/excalidraw/actions/actionToggleStats.d.ts +6 -2
- package/dist/excalidraw/actions/actionToggleStats.js +4 -3
- package/dist/excalidraw/actions/actionToggleViewMode.d.ts +5 -2
- package/dist/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
- package/dist/excalidraw/actions/actionZindex.d.ts +8 -4
- package/dist/excalidraw/actions/actionZindex.js +4 -0
- package/dist/excalidraw/actions/manager.d.ts +3 -3
- package/dist/excalidraw/actions/register.d.ts +1 -1
- package/dist/excalidraw/actions/shortcuts.d.ts +2 -2
- package/dist/excalidraw/actions/types.d.ts +6 -6
- package/dist/excalidraw/align.d.ts +1 -1
- package/dist/excalidraw/animated-trail.d.ts +2 -2
- package/dist/excalidraw/appState.d.ts +5 -2
- package/dist/excalidraw/appState.js +6 -3
- package/dist/excalidraw/change.d.ts +4 -4
- package/dist/excalidraw/change.js +14 -7
- package/dist/excalidraw/charts.d.ts +1 -1
- package/dist/excalidraw/clients.d.ts +2 -2
- package/dist/excalidraw/clients.js +1 -1
- package/dist/excalidraw/clipboard.d.ts +3 -3
- package/dist/excalidraw/colors.d.ts +1 -1
- package/dist/excalidraw/components/Actions.d.ts +3 -3
- package/dist/excalidraw/components/Actions.js +9 -6
- package/dist/excalidraw/components/App.d.ts +10 -16
- package/dist/excalidraw/components/App.js +190 -142
- package/dist/excalidraw/components/ButtonIconSelect.js +1 -1
- package/dist/excalidraw/components/CheckboxItem.js +1 -1
- package/dist/excalidraw/components/ColorPicker/ColorInput.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/ColorInput.js +1 -1
- package/dist/excalidraw/components/ColorPicker/ColorPicker.d.ts +4 -4
- package/dist/excalidraw/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/excalidraw/components/ColorPicker/Picker.d.ts +3 -3
- package/dist/excalidraw/components/ColorPicker/PickerColorList.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/PickerHeading.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/ShadeList.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +2 -2
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.js +1 -1
- package/dist/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/dist/excalidraw/components/ColorPicker/keyboardNavHandlers.js +1 -1
- package/dist/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/excalidraw/components/CommandPalette/CommandPalette.js +5 -5
- package/dist/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -1
- package/dist/excalidraw/components/CommandPalette/types.d.ts +3 -3
- package/dist/excalidraw/components/ConfirmDialog.d.ts +1 -1
- package/dist/excalidraw/components/ContextMenu.d.ts +2 -2
- package/dist/excalidraw/components/ContextMenu.js +2 -2
- package/dist/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/excalidraw/components/DefaultSidebar.d.ts +2 -2
- package/dist/excalidraw/components/Dialog.js +1 -1
- package/dist/excalidraw/components/DialogActionButton.d.ts +1 -1
- package/dist/excalidraw/components/EyeDropper.d.ts +2 -2
- package/dist/excalidraw/components/FollowMode/FollowMode.d.ts +1 -1
- package/dist/excalidraw/components/FollowMode/FollowMode.js +1 -1
- package/dist/excalidraw/components/HelpDialog.js +1 -1
- package/dist/excalidraw/components/HintViewer.d.ts +1 -1
- package/dist/excalidraw/components/IconPicker.js +2 -2
- package/dist/excalidraw/components/ImageExportDialog.d.ts +1 -1
- package/dist/excalidraw/components/InitializeApp.d.ts +2 -2
- package/dist/excalidraw/components/JSONExportDialog.d.ts +3 -3
- package/dist/excalidraw/components/LayerUI.d.ts +4 -4
- package/dist/excalidraw/components/LayerUI.js +10 -7
- package/dist/excalidraw/components/LibraryMenu.d.ts +2 -2
- package/dist/excalidraw/components/LibraryMenuBrowseButton.d.ts +1 -1
- package/dist/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/excalidraw/components/LibraryMenuHeaderContent.d.ts +2 -2
- package/dist/excalidraw/components/LibraryMenuItems.d.ts +1 -1
- package/dist/excalidraw/components/LibraryMenuSection.d.ts +5 -4
- package/dist/excalidraw/components/LibraryUnit.d.ts +2 -2
- package/dist/excalidraw/components/LoadingMessage.d.ts +1 -1
- package/dist/excalidraw/components/MagicSettings.js +2 -2
- package/dist/excalidraw/components/MobileMenu.d.ts +3 -3
- package/dist/excalidraw/components/MobileMenu.js +2 -6
- package/dist/excalidraw/components/Modal.d.ts +1 -1
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/excalidraw/components/PasteChartDialog.d.ts +1 -1
- package/dist/excalidraw/components/PasteChartDialog.js +1 -1
- package/dist/excalidraw/components/PublishLibrary.d.ts +1 -1
- package/dist/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/Sidebar.js +1 -1
- package/dist/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/common.d.ts +1 -1
- package/dist/excalidraw/components/Stats/Angle.d.ts +12 -0
- package/dist/excalidraw/components/Stats/Angle.js +52 -0
- package/dist/excalidraw/components/Stats/Collapsible.d.ts +9 -0
- package/dist/excalidraw/components/Stats/Collapsible.js +12 -0
- package/dist/excalidraw/components/Stats/Dimension.d.ts +12 -0
- package/dist/excalidraw/components/Stats/Dimension.js +67 -0
- package/dist/excalidraw/components/Stats/DragInput.d.ts +32 -0
- package/dist/excalidraw/components/Stats/DragInput.js +174 -0
- package/dist/excalidraw/components/Stats/FontSize.d.ts +12 -0
- package/dist/excalidraw/components/Stats/FontSize.js +50 -0
- package/dist/excalidraw/components/Stats/MultiAngle.d.ts +12 -0
- package/dist/excalidraw/components/Stats/MultiAngle.js +66 -0
- package/dist/excalidraw/components/Stats/MultiDimension.d.ts +15 -0
- package/dist/excalidraw/components/Stats/MultiDimension.js +197 -0
- package/dist/excalidraw/components/Stats/MultiFontSize.d.ts +13 -0
- package/dist/excalidraw/components/Stats/MultiFontSize.js +72 -0
- package/dist/excalidraw/components/Stats/MultiPosition.d.ts +15 -0
- package/dist/excalidraw/components/Stats/MultiPosition.js +100 -0
- package/dist/excalidraw/components/Stats/Position.d.ts +13 -0
- package/dist/excalidraw/components/Stats/Position.js +39 -0
- package/dist/excalidraw/components/Stats/index.d.ts +16 -0
- package/dist/excalidraw/components/Stats/index.js +78 -0
- package/dist/excalidraw/components/Stats/utils.d.ts +25 -0
- package/dist/excalidraw/components/Stats/utils.js +158 -0
- package/dist/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/TTDDialog.js +2 -2
- package/dist/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
- package/dist/excalidraw/components/TTDDialog/common.d.ts +4 -4
- package/dist/excalidraw/components/TextField.d.ts +1 -1
- package/dist/excalidraw/components/Toast.d.ts +1 -1
- package/dist/excalidraw/components/ToolButton.d.ts +3 -2
- package/dist/excalidraw/components/Trans.d.ts +1 -1
- package/dist/excalidraw/components/UserList.d.ts +1 -1
- package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
- package/dist/excalidraw/components/canvases/InteractiveCanvas.js +4 -2
- package/dist/excalidraw/components/canvases/StaticCanvas.d.ts +2 -2
- package/dist/excalidraw/components/canvases/StaticCanvas.js +2 -2
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/excalidraw/components/footer/Footer.d.ts +2 -2
- package/dist/excalidraw/components/hyperlink/Hyperlink.d.ts +2 -2
- package/dist/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/dist/excalidraw/components/icons.d.ts +6 -2
- package/dist/excalidraw/components/icons.js +22 -6
- package/dist/excalidraw/constants.d.ts +8 -2
- package/dist/excalidraw/constants.js +8 -1
- package/dist/excalidraw/context/ui-appState.d.ts +1 -1
- package/dist/excalidraw/cursor.d.ts +1 -1
- package/dist/excalidraw/data/EditorLocalStorage.d.ts +2 -2
- package/dist/excalidraw/data/blob.d.ts +5 -5
- package/dist/excalidraw/data/filesystem.d.ts +2 -1
- package/dist/excalidraw/data/index.d.ts +4 -4
- package/dist/excalidraw/data/json.d.ts +3 -3
- package/dist/excalidraw/data/library.d.ts +3 -3
- package/dist/excalidraw/data/magic.d.ts +3 -3
- package/dist/excalidraw/data/reconcile.d.ts +3 -3
- package/dist/excalidraw/data/resave.d.ts +2 -2
- package/dist/excalidraw/data/restore.d.ts +3 -3
- package/dist/excalidraw/data/restore.js +16 -1
- package/dist/excalidraw/data/transform.d.ts +3 -3
- package/dist/excalidraw/data/types.d.ts +3 -3
- package/dist/excalidraw/element/ElementCanvasButtons.d.ts +1 -1
- package/dist/excalidraw/element/binding.d.ts +7 -21
- package/dist/excalidraw/element/binding.js +127 -102
- package/dist/excalidraw/element/bounds.d.ts +3 -3
- package/dist/excalidraw/element/collision.d.ts +3 -3
- package/dist/excalidraw/element/collision.js +1 -1
- package/dist/excalidraw/element/containerCache.d.ts +1 -1
- package/dist/excalidraw/element/dragElements.d.ts +4 -4
- package/dist/excalidraw/element/dragElements.js +27 -3
- package/dist/excalidraw/element/embeddable.d.ts +8 -5
- package/dist/excalidraw/element/image.d.ts +2 -2
- package/dist/excalidraw/element/index.d.ts +2 -2
- package/dist/excalidraw/element/index.js +1 -1
- package/dist/excalidraw/element/linearElementEditor.d.ts +8 -5
- package/dist/excalidraw/element/linearElementEditor.js +7 -4
- package/dist/excalidraw/element/mutateElement.d.ts +2 -2
- package/dist/excalidraw/element/mutateElement.js +1 -1
- package/dist/excalidraw/element/newElement.d.ts +5 -8
- package/dist/excalidraw/element/newElement.js +16 -14
- package/dist/excalidraw/element/resizeElements.d.ts +11 -3
- package/dist/excalidraw/element/resizeElements.js +75 -23
- package/dist/excalidraw/element/resizeTest.d.ts +4 -4
- package/dist/excalidraw/element/resizeTest.js +2 -4
- package/dist/excalidraw/element/showSelectedShapeActions.d.ts +2 -2
- package/dist/excalidraw/element/sizeHelpers.d.ts +2 -2
- package/dist/excalidraw/element/sortElements.d.ts +1 -1
- package/dist/excalidraw/element/textElement.d.ts +5 -4
- package/dist/excalidraw/element/textElement.js +11 -3
- package/dist/excalidraw/element/textWysiwyg.d.ts +12 -6
- package/dist/excalidraw/element/textWysiwyg.js +38 -17
- package/dist/excalidraw/element/transformHandles.d.ts +3 -3
- package/dist/excalidraw/element/transformHandles.js +0 -10
- package/dist/excalidraw/element/typeChecks.d.ts +4 -4
- package/dist/excalidraw/element/types.d.ts +11 -4
- package/dist/excalidraw/emitter.d.ts +1 -1
- package/dist/excalidraw/fractionalIndex.d.ts +1 -1
- package/dist/excalidraw/fractionalIndex.js +2 -4
- package/dist/excalidraw/frame.d.ts +3 -3
- package/dist/excalidraw/gatransforms.d.ts +1 -1
- package/dist/excalidraw/gesture.d.ts +1 -1
- package/dist/excalidraw/groups.d.ts +4 -4
- package/dist/excalidraw/history.d.ts +4 -4
- package/dist/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/dist/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/excalidraw/i18n.d.ts +1 -1
- package/dist/excalidraw/index.d.ts +1 -1
- package/dist/excalidraw/jotai.d.ts +1 -1
- package/dist/excalidraw/laser-trails.d.ts +3 -2
- package/dist/excalidraw/locales/en.json +24 -3
- package/dist/excalidraw/math.d.ts +4 -2
- package/dist/excalidraw/math.js +6 -0
- package/dist/excalidraw/mermaid.d.ts +2 -0
- package/dist/excalidraw/mermaid.js +28 -0
- package/dist/excalidraw/points.d.ts +1 -1
- package/dist/excalidraw/queue.d.ts +1 -1
- package/dist/excalidraw/renderer/helpers.d.ts +2 -2
- package/dist/excalidraw/renderer/interactiveScene.d.ts +2 -2
- package/dist/excalidraw/renderer/interactiveScene.js +32 -6
- package/dist/excalidraw/renderer/renderElement.d.ts +4 -4
- package/dist/excalidraw/renderer/renderElement.js +5 -5
- package/dist/excalidraw/renderer/renderSnaps.d.ts +1 -1
- package/dist/excalidraw/renderer/staticScene.d.ts +1 -1
- package/dist/excalidraw/renderer/staticSvgScene.d.ts +4 -4
- package/dist/excalidraw/scene/Fonts.d.ts +2 -4
- package/dist/excalidraw/scene/Fonts.js +12 -15
- package/dist/excalidraw/scene/Renderer.d.ts +4 -4
- package/dist/excalidraw/scene/Renderer.js +2 -3
- package/dist/excalidraw/scene/Scene.d.ts +16 -7
- package/dist/excalidraw/scene/Scene.js +17 -8
- package/dist/excalidraw/scene/Shape.d.ts +1 -1
- package/dist/excalidraw/scene/ShapeCache.d.ts +4 -4
- package/dist/excalidraw/scene/comparisons.d.ts +2 -2
- package/dist/excalidraw/scene/export.d.ts +2 -2
- package/dist/excalidraw/scene/export.js +2 -2
- package/dist/excalidraw/scene/scroll.d.ts +2 -2
- package/dist/excalidraw/scene/scrollbars.d.ts +3 -3
- package/dist/excalidraw/scene/selection.d.ts +2 -2
- package/dist/excalidraw/scene/types.d.ts +6 -8
- package/dist/excalidraw/scene/zoom.d.ts +1 -1
- package/dist/excalidraw/shapes.d.ts +7 -0
- package/dist/excalidraw/shapes.js +40 -0
- package/dist/excalidraw/snapping.d.ts +4 -4
- package/dist/excalidraw/snapping.js +2 -1
- package/dist/excalidraw/store.d.ts +34 -4
- package/dist/excalidraw/store.js +27 -0
- package/dist/excalidraw/types.d.ts +25 -20
- package/dist/excalidraw/utils.d.ts +4 -4
- package/dist/excalidraw/zindex.d.ts +2 -2
- package/dist/prod/{en-XW4JO6VX.json → en-EB2MBPAV.json} +24 -3
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +39 -39
- package/dist/utils/bbox.d.ts +2 -2
- package/dist/utils/collision.d.ts +1 -1
- package/dist/utils/export.d.ts +2 -2
- package/dist/utils/geometry/geometry.d.ts +1 -1
- package/dist/utils/geometry/shape.d.ts +1 -1
- package/dist/utils/withinBounds.d.ts +1 -1
- package/history.ts +4 -4
- package/package.json +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-47LVF2XL.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/chunk-XOM7LNOU.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/dist-ITJNUBZF.js.map +0 -7
- package/dist/browser/prod/excalidraw-assets/chunk-4SNEEDZH.js +0 -55
- package/dist/browser/prod/excalidraw-assets/dist-54276HPL.js +0 -6
- package/dist/browser/prod/excalidraw-assets/en-7GPZE2Y2.js +0 -1
- package/dist/browser/prod/excalidraw-assets/image-ISQJGWLB.js +0 -1
- package/dist/excalidraw/components/Stats.d.ts +0 -11
- package/dist/excalidraw/components/Stats.js +0 -13
- /package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js.map → en-AZFA5HJJ.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-LHMGJWTI.js.map → image-5XCR4WHS.js.map} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { bindOrUnbindLinearElements, updateBoundElements, } from "../../element/binding";
|
|
2
|
+
import { mutateElement } from "../../element/mutateElement";
|
|
3
|
+
import { measureFontSizeFromWidth, rescalePointsInElement, } from "../../element/resizeElements";
|
|
4
|
+
import { getApproxMinLineHeight, getApproxMinLineWidth, getBoundTextElement, getBoundTextMaxWidth, handleBindTextResize, } from "../../element/textElement";
|
|
5
|
+
import { isFrameLikeElement, isLinearElement, isTextElement, } from "../../element/typeChecks";
|
|
6
|
+
import { getSelectedGroupIds, getElementsInGroup, isInGroup, } from "../../groups";
|
|
7
|
+
import { rotate } from "../../math";
|
|
8
|
+
import { getFontString } from "../../utils";
|
|
9
|
+
export const SMALLEST_DELTA = 0.01;
|
|
10
|
+
export const isPropertyEditable = (element, property) => {
|
|
11
|
+
if (property === "height" && isTextElement(element)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (property === "width" && isTextElement(element)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (property === "angle" && isFrameLikeElement(element)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
export const getStepSizedValue = (value, stepSize) => {
|
|
23
|
+
const v = value + stepSize / 2;
|
|
24
|
+
return v - (v % stepSize);
|
|
25
|
+
};
|
|
26
|
+
export const getElementsInAtomicUnit = (atomicUnit, elementsMap, originalElementsMap) => {
|
|
27
|
+
return Object.keys(atomicUnit)
|
|
28
|
+
.map((id) => ({
|
|
29
|
+
original: (originalElementsMap ?? elementsMap).get(id),
|
|
30
|
+
latest: elementsMap.get(id),
|
|
31
|
+
}))
|
|
32
|
+
.filter((el) => el.original !== undefined && el.latest !== undefined);
|
|
33
|
+
};
|
|
34
|
+
export const newOrigin = (x1, y1, w1, h1, w2, h2, angle) => {
|
|
35
|
+
/**
|
|
36
|
+
* The formula below is the result of solving
|
|
37
|
+
* rotate(x1, y1, cx1, cy1, angle) = rotate(x2, y2, cx2, cy2, angle)
|
|
38
|
+
* where rotate is the function defined in math.ts
|
|
39
|
+
*
|
|
40
|
+
* This is so that the new origin (x2, y2),
|
|
41
|
+
* when rotated against the new center (cx2, cy2),
|
|
42
|
+
* coincides with (x1, y1) rotated against (cx1, cy1)
|
|
43
|
+
*
|
|
44
|
+
* The reason for doing this computation is so the element's top left corner
|
|
45
|
+
* on the canvas remains fixed after any changes in its dimension.
|
|
46
|
+
*/
|
|
47
|
+
return {
|
|
48
|
+
x: x1 +
|
|
49
|
+
(w1 - w2) / 2 +
|
|
50
|
+
((w2 - w1) / 2) * Math.cos(angle) +
|
|
51
|
+
((h1 - h2) / 2) * Math.sin(angle),
|
|
52
|
+
y: y1 +
|
|
53
|
+
(h1 - h2) / 2 +
|
|
54
|
+
((w2 - w1) / 2) * Math.sin(angle) +
|
|
55
|
+
((h2 - h1) / 2) * Math.cos(angle),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export const resizeElement = (nextWidth, nextHeight, keepAspectRatio, origElement, elementsMap, shouldInformMutation = true) => {
|
|
59
|
+
const latestElement = elementsMap.get(origElement.id);
|
|
60
|
+
if (!latestElement) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let boundTextFont = {};
|
|
64
|
+
const boundTextElement = getBoundTextElement(latestElement, elementsMap);
|
|
65
|
+
if (boundTextElement) {
|
|
66
|
+
const minWidth = getApproxMinLineWidth(getFontString(boundTextElement), boundTextElement.lineHeight);
|
|
67
|
+
const minHeight = getApproxMinLineHeight(boundTextElement.fontSize, boundTextElement.lineHeight);
|
|
68
|
+
nextWidth = Math.max(nextWidth, minWidth);
|
|
69
|
+
nextHeight = Math.max(nextHeight, minHeight);
|
|
70
|
+
}
|
|
71
|
+
mutateElement(latestElement, {
|
|
72
|
+
...newOrigin(latestElement.x, latestElement.y, latestElement.width, latestElement.height, nextWidth, nextHeight, latestElement.angle),
|
|
73
|
+
width: nextWidth,
|
|
74
|
+
height: nextHeight,
|
|
75
|
+
...rescalePointsInElement(origElement, nextWidth, nextHeight, true),
|
|
76
|
+
}, shouldInformMutation);
|
|
77
|
+
updateBindings(latestElement, elementsMap, {
|
|
78
|
+
newSize: {
|
|
79
|
+
width: nextWidth,
|
|
80
|
+
height: nextHeight,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (boundTextElement) {
|
|
84
|
+
boundTextFont = {
|
|
85
|
+
fontSize: boundTextElement.fontSize,
|
|
86
|
+
};
|
|
87
|
+
if (keepAspectRatio) {
|
|
88
|
+
const updatedElement = {
|
|
89
|
+
...latestElement,
|
|
90
|
+
width: nextWidth,
|
|
91
|
+
height: nextHeight,
|
|
92
|
+
};
|
|
93
|
+
const nextFont = measureFontSizeFromWidth(boundTextElement, elementsMap, getBoundTextMaxWidth(updatedElement, boundTextElement));
|
|
94
|
+
boundTextFont = {
|
|
95
|
+
fontSize: nextFont?.size ?? boundTextElement.fontSize,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (boundTextElement && boundTextFont) {
|
|
100
|
+
mutateElement(boundTextElement, {
|
|
101
|
+
fontSize: boundTextFont.fontSize,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
handleBindTextResize(latestElement, elementsMap, "e", keepAspectRatio);
|
|
105
|
+
};
|
|
106
|
+
export const moveElement = (newTopLeftX, newTopLeftY, originalElement, elementsMap, originalElementsMap, shouldInformMutation = true) => {
|
|
107
|
+
const latestElement = elementsMap.get(originalElement.id);
|
|
108
|
+
if (!latestElement) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const [cx, cy] = [
|
|
112
|
+
originalElement.x + originalElement.width / 2,
|
|
113
|
+
originalElement.y + originalElement.height / 2,
|
|
114
|
+
];
|
|
115
|
+
const [topLeftX, topLeftY] = rotate(originalElement.x, originalElement.y, cx, cy, originalElement.angle);
|
|
116
|
+
const changeInX = newTopLeftX - topLeftX;
|
|
117
|
+
const changeInY = newTopLeftY - topLeftY;
|
|
118
|
+
const [x, y] = rotate(newTopLeftX, newTopLeftY, cx + changeInX, cy + changeInY, -originalElement.angle);
|
|
119
|
+
mutateElement(latestElement, {
|
|
120
|
+
x,
|
|
121
|
+
y,
|
|
122
|
+
}, shouldInformMutation);
|
|
123
|
+
updateBindings(latestElement, elementsMap);
|
|
124
|
+
const boundTextElement = getBoundTextElement(originalElement, originalElementsMap);
|
|
125
|
+
if (boundTextElement) {
|
|
126
|
+
const latestBoundTextElement = elementsMap.get(boundTextElement.id);
|
|
127
|
+
latestBoundTextElement &&
|
|
128
|
+
mutateElement(latestBoundTextElement, {
|
|
129
|
+
x: boundTextElement.x + changeInX,
|
|
130
|
+
y: boundTextElement.y + changeInY,
|
|
131
|
+
}, shouldInformMutation);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
export const getAtomicUnits = (targetElements, appState) => {
|
|
135
|
+
const selectedGroupIds = getSelectedGroupIds(appState);
|
|
136
|
+
const _atomicUnits = selectedGroupIds.map((gid) => {
|
|
137
|
+
return getElementsInGroup(targetElements, gid).reduce((acc, el) => {
|
|
138
|
+
acc[el.id] = true;
|
|
139
|
+
return acc;
|
|
140
|
+
}, {});
|
|
141
|
+
});
|
|
142
|
+
targetElements
|
|
143
|
+
.filter((el) => !isInGroup(el))
|
|
144
|
+
.forEach((el) => {
|
|
145
|
+
_atomicUnits.push({
|
|
146
|
+
[el.id]: true,
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
return _atomicUnits;
|
|
150
|
+
};
|
|
151
|
+
export const updateBindings = (latestElement, elementsMap, options) => {
|
|
152
|
+
if (isLinearElement(latestElement)) {
|
|
153
|
+
bindOrUnbindLinearElements([latestElement], elementsMap, true, []);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
updateBoundElements(latestElement, elementsMap, options);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./MermaidToExcalidraw.scss";
|
|
3
|
-
import { MermaidToExcalidrawLibProps } from "./common";
|
|
3
|
+
import type { MermaidToExcalidrawLibProps } from "./common";
|
|
4
4
|
declare const MermaidToExcalidraw: ({ mermaidToExcalidrawLib, }: {
|
|
5
5
|
mermaidToExcalidrawLib: MermaidToExcalidrawLibProps;
|
|
6
6
|
}) => JSX.Element;
|
|
@@ -141,8 +141,8 @@ export const TTDDialogBase = withInternalFallback("TTDDialogBase", ({ tab, ...re
|
|
|
141
141
|
marginLeft: "10px",
|
|
142
142
|
fontSize: 10,
|
|
143
143
|
borderRadius: "12px",
|
|
144
|
-
background: "
|
|
145
|
-
color: "
|
|
144
|
+
background: "var(--color-promo)",
|
|
145
|
+
color: "var(--color-surface-lowest)",
|
|
146
146
|
}, children: "AI Beta" })] }) }), _jsx(TTDDialogTabTrigger, { tab: "mermaid", children: "Mermaid" })] })), _jsx(TTDDialogTab, { className: "ttd-dialog-content", tab: "mermaid", children: _jsx(MermaidToExcalidraw, { mermaidToExcalidrawLib: mermaidToExcalidrawLib }) }), !("__fallback" in rest) && (_jsxs(TTDDialogTab, { className: "ttd-dialog-content", tab: "text-to-diagram", children: [_jsx("div", { className: "ttd-dialog-desc", children: "Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar." }), _jsxs(TTDDialogPanels, { children: [_jsx(TTDDialogPanel, { label: t("labels.prompt"), panelAction: {
|
|
147
147
|
action: onGenerate,
|
|
148
148
|
label: "Generate",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MermaidOptions } from "@excalidraw/mermaid-to-excalidraw";
|
|
3
|
-
import { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
|
|
4
|
-
import { NonDeletedExcalidrawElement } from "../../element/types";
|
|
5
|
-
import { AppClassProperties, BinaryFiles } from "../../types";
|
|
2
|
+
import type { MermaidOptions } from "@excalidraw/mermaid-to-excalidraw";
|
|
3
|
+
import type { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
|
|
4
|
+
import type { NonDeletedExcalidrawElement } from "../../element/types";
|
|
5
|
+
import type { AppClassProperties, BinaryFiles } from "../../types";
|
|
6
6
|
export interface MermaidToExcalidrawLibProps {
|
|
7
7
|
loaded: boolean;
|
|
8
8
|
api: Promise<{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./ToolIcon.scss";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { PointerType } from "../element/types";
|
|
4
5
|
export type ToolButtonSize = "small" | "medium";
|
|
5
6
|
type ToolButtonBaseProps = {
|
|
6
7
|
icon?: React.ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TranslationKeys } from "../i18n";
|
|
2
|
+
import type { TranslationKeys } from "../i18n";
|
|
3
3
|
declare const Trans: ({ i18nKey, children, ...props }: {
|
|
4
4
|
[key: string]: React.ReactNode | ((el: React.ReactNode) => React.ReactNode);
|
|
5
5
|
i18nKey: TranslationKeys;
|
|
@@ -2,14 +2,15 @@ import React from "react";
|
|
|
2
2
|
import type { DOMAttributes } from "react";
|
|
3
3
|
import type { Device, InteractiveCanvasAppState } from "../../types";
|
|
4
4
|
import type { RenderableElementsMap, RenderInteractiveSceneCallback } from "../../scene/types";
|
|
5
|
-
import type { NonDeletedExcalidrawElement } from "../../element/types";
|
|
5
|
+
import type { NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../../element/types";
|
|
6
6
|
type InteractiveCanvasProps = {
|
|
7
7
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
8
8
|
canvas: HTMLCanvasElement | null;
|
|
9
9
|
elementsMap: RenderableElementsMap;
|
|
10
10
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
11
11
|
selectedElements: readonly NonDeletedExcalidrawElement[];
|
|
12
|
-
|
|
12
|
+
allElementsMap: NonDeletedSceneElementsMap;
|
|
13
|
+
sceneNonce: number | undefined;
|
|
13
14
|
selectionNonce: number | undefined;
|
|
14
15
|
scale: number;
|
|
15
16
|
appState: InteractiveCanvasAppState;
|
|
@@ -49,6 +49,7 @@ const InteractiveCanvas = (props) => {
|
|
|
49
49
|
elementsMap: props.elementsMap,
|
|
50
50
|
visibleElements: props.visibleElements,
|
|
51
51
|
selectedElements: props.selectedElements,
|
|
52
|
+
allElementsMap: props.allElementsMap,
|
|
52
53
|
scale: window.devicePixelRatio,
|
|
53
54
|
appState: props.appState,
|
|
54
55
|
renderConfig: {
|
|
@@ -99,14 +100,15 @@ const getRelevantAppStateProps = (appState) => ({
|
|
|
99
100
|
activeEmbeddable: appState.activeEmbeddable,
|
|
100
101
|
snapLines: appState.snapLines,
|
|
101
102
|
zenModeEnabled: appState.zenModeEnabled,
|
|
103
|
+
editingElement: appState.editingElement,
|
|
102
104
|
});
|
|
103
105
|
const areEqual = (prevProps, nextProps) => {
|
|
104
106
|
// This could be further optimised if needed, as we don't have to render interactive canvas on each scene mutation
|
|
105
107
|
if (prevProps.selectionNonce !== nextProps.selectionNonce ||
|
|
106
|
-
prevProps.
|
|
108
|
+
prevProps.sceneNonce !== nextProps.sceneNonce ||
|
|
107
109
|
prevProps.scale !== nextProps.scale ||
|
|
108
110
|
// we need to memoize on elementsMap because they may have renewed
|
|
109
|
-
// even if
|
|
111
|
+
// even if sceneNonce didn't change (e.g. we filter elements out based
|
|
110
112
|
// on appState)
|
|
111
113
|
prevProps.elementsMap !== nextProps.elementsMap ||
|
|
112
114
|
prevProps.visibleElements !== nextProps.visibleElements ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
2
|
+
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import type { StaticCanvasAppState } from "../../types";
|
|
4
4
|
import type { RenderableElementsMap, StaticCanvasRenderConfig } from "../../scene/types";
|
|
5
5
|
import type { NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../../element/types";
|
|
@@ -9,7 +9,7 @@ type StaticCanvasProps = {
|
|
|
9
9
|
elementsMap: RenderableElementsMap;
|
|
10
10
|
allElementsMap: NonDeletedSceneElementsMap;
|
|
11
11
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
12
|
-
|
|
12
|
+
sceneNonce: number | undefined;
|
|
13
13
|
selectionNonce: number | undefined;
|
|
14
14
|
scale: number;
|
|
15
15
|
appState: StaticCanvasAppState;
|
|
@@ -70,10 +70,10 @@ const getRelevantAppStateProps = (appState) => ({
|
|
|
70
70
|
editingGroupId: appState.editingGroupId,
|
|
71
71
|
});
|
|
72
72
|
const areEqual = (prevProps, nextProps) => {
|
|
73
|
-
if (prevProps.
|
|
73
|
+
if (prevProps.sceneNonce !== nextProps.sceneNonce ||
|
|
74
74
|
prevProps.scale !== nextProps.scale ||
|
|
75
75
|
// we need to memoize on elementsMap because they may have renewed
|
|
76
|
-
// even if
|
|
76
|
+
// even if sceneNonce didn't change (e.g. we filter elements out based
|
|
77
77
|
// on appState)
|
|
78
78
|
prevProps.elementsMap !== nextProps.elementsMap ||
|
|
79
79
|
prevProps.visibleElements !== nextProps.visibleElements) {
|
|
@@ -11,10 +11,10 @@ export const DropDownMenuItemBadge = ({ children, }) => {
|
|
|
11
11
|
display: "inline-flex",
|
|
12
12
|
marginLeft: "auto",
|
|
13
13
|
padding: "2px 4px",
|
|
14
|
-
background: "
|
|
14
|
+
background: "var(--color-promo)",
|
|
15
|
+
color: "var(--color-surface-lowest)",
|
|
15
16
|
borderRadius: 6,
|
|
16
17
|
fontSize: 9,
|
|
17
|
-
color: "black",
|
|
18
18
|
fontFamily: "Cascadia, monospace",
|
|
19
19
|
}, children: children }));
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ActionManager } from "../../actions/manager";
|
|
3
|
-
import { UIAppState } from "../../types";
|
|
2
|
+
import type { ActionManager } from "../../actions/manager";
|
|
3
|
+
import type { UIAppState } from "../../types";
|
|
4
4
|
declare const Footer: {
|
|
5
5
|
({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
|
|
6
6
|
appState: UIAppState;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AppState, ExcalidrawProps, UIAppState } from "../../types";
|
|
3
|
-
import { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "../../element/types";
|
|
2
|
+
import type { AppState, ExcalidrawProps, UIAppState } from "../../types";
|
|
3
|
+
import type { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "../../element/types";
|
|
4
4
|
import "./Hyperlink.scss";
|
|
5
5
|
export declare const Hyperlink: ({ element, elementsMap, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
|
|
6
6
|
element: NonDeletedExcalidrawElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Bounds } from "../../element/bounds";
|
|
2
|
-
import { ElementsMap, NonDeletedExcalidrawElement } from "../../element/types";
|
|
3
|
-
import { AppState, UIAppState } from "../../types";
|
|
1
|
+
import type { Bounds } from "../../element/bounds";
|
|
2
|
+
import type { ElementsMap, NonDeletedExcalidrawElement } from "../../element/types";
|
|
3
|
+
import type { AppState, UIAppState } from "../../types";
|
|
4
4
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
5
5
|
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => Bounds;
|
|
6
6
|
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Theme } from "../element/types";
|
|
2
|
+
import type { Theme } from "../element/types";
|
|
3
3
|
export declare const iconFillColor: (theme: Theme) => string;
|
|
4
4
|
type Opts = {
|
|
5
5
|
width?: number;
|
|
@@ -154,6 +154,7 @@ export declare const TextAlignBottomIcon: React.MemoExoticComponent<({ theme }:
|
|
|
154
154
|
export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }: {
|
|
155
155
|
theme: Theme;
|
|
156
156
|
}) => JSX.Element>;
|
|
157
|
+
export declare const angleIcon: JSX.Element;
|
|
157
158
|
export declare const publishIcon: JSX.Element;
|
|
158
159
|
export declare const eraser: JSX.Element;
|
|
159
160
|
export declare const handIcon: JSX.Element;
|
|
@@ -195,7 +196,10 @@ export declare const pngIcon: JSX.Element;
|
|
|
195
196
|
export declare const magnetIcon: JSX.Element;
|
|
196
197
|
export declare const coffeeIcon: JSX.Element;
|
|
197
198
|
export declare const DeviceDesktopIcon: JSX.Element;
|
|
198
|
-
export declare const
|
|
199
|
+
export declare const loginIcon: JSX.Element;
|
|
199
200
|
export declare const youtubeIcon: JSX.Element;
|
|
200
201
|
export declare const gridIcon: JSX.Element;
|
|
202
|
+
export declare const lineEditorIcon: JSX.Element;
|
|
203
|
+
export declare const collapseDownIcon: JSX.Element;
|
|
204
|
+
export declare const collapseUpIcon: JSX.Element;
|
|
201
205
|
export {};
|
|
@@ -121,10 +121,22 @@ export const shareWindows = createIcon(_jsxs(_Fragment, { children: [_jsx("path"
|
|
|
121
121
|
// Icon imported form Storybook
|
|
122
122
|
// Storybook is licensed under MIT https://github.com/storybookjs/storybook/blob/next/LICENSE
|
|
123
123
|
export const resetZoom = createIcon(_jsx("path", { stroke: "currentColor", strokeWidth: "40", fill: "currentColor", d: "M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z" }), { width: 1024 });
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
export const
|
|
127
|
-
export const
|
|
124
|
+
const arrowBarToTopJSX = (_jsxs("g", { strokeWidth: 1.5, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M12 10l0 10" }), _jsx("path", { d: "M12 10l4 4" }), _jsx("path", { d: "M12 10l-4 4" }), _jsx("path", { d: "M4 4l16 0" })] }));
|
|
125
|
+
const arrownNarrowUpJSX = (_jsxs("g", { strokeWidth: 1.5, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M12 5l0 14" }), _jsx("path", { d: "M16 9l-4 -4" }), _jsx("path", { d: "M8 9l4 -4" })] }));
|
|
126
|
+
export const BringForwardIcon = createIcon(arrownNarrowUpJSX, tablerIconProps);
|
|
127
|
+
export const SendBackwardIcon = createIcon(arrownNarrowUpJSX, {
|
|
128
|
+
...tablerIconProps,
|
|
129
|
+
style: {
|
|
130
|
+
transform: "rotate(180deg)",
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
export const BringToFrontIcon = createIcon(arrowBarToTopJSX, tablerIconProps);
|
|
134
|
+
export const SendToBackIcon = createIcon(arrowBarToTopJSX, {
|
|
135
|
+
...tablerIconProps,
|
|
136
|
+
style: {
|
|
137
|
+
transform: "rotate(180deg)",
|
|
138
|
+
},
|
|
139
|
+
});
|
|
128
140
|
//
|
|
129
141
|
// Align action icons created from scratch to match those of z-index actions
|
|
130
142
|
// Note: vertical align icons are flipped so the larger item is always the
|
|
@@ -200,6 +212,7 @@ export const TextAlignTopIcon = React.memo(({ theme }) => createIcon(_jsxs("g",
|
|
|
200
212
|
export const TextAlignBottomIcon = React.memo(({ theme }) => createIcon(_jsxs("g", { strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("line", { x1: "4", y1: "20", x2: "20", y2: "20" }), _jsx("rect", { x: "9", y: "4", width: "6", height: "12", rx: "2" })] }), tablerIconProps));
|
|
201
213
|
// tabler-icons: layout-align-middle
|
|
202
214
|
export const TextAlignMiddleIcon = React.memo(({ theme }) => createIcon(_jsxs("g", { strokeWidth: "1.5", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("line", { x1: "4", y1: "12", x2: "9", y2: "12" }), _jsx("line", { x1: "15", y1: "12", x2: "20", y2: "12" }), _jsx("rect", { x: "9", y: "6", width: "6", height: "12", rx: "2" })] }), tablerIconProps));
|
|
215
|
+
export const angleIcon = createIcon(_jsxs("g", { children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M21 19h-18l9 -15" }), _jsx("path", { d: "M20.615 15.171h.015" }), _jsx("path", { d: "M19.515 11.771h.015" }), _jsx("path", { d: "M17.715 8.671h.015" }), _jsx("path", { d: "M15.415 5.971h.015" })] }), tablerIconProps);
|
|
203
216
|
export const publishIcon = createIcon(_jsx("path", { d: "M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z", fill: "currentColor" }), { width: 640, height: 512 });
|
|
204
217
|
export const eraser = createIcon(_jsx("path", { d: "M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z" }));
|
|
205
218
|
export const handIcon = createIcon(_jsxs("g", { strokeWidth: 1.25, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5" }), _jsx("path", { d: "M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5" }), _jsx("path", { d: "M14 5.5a1.5 1.5 0 0 1 3 0v6.5" }), _jsx("path", { d: "M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47" })] }), tablerIconProps);
|
|
@@ -241,7 +254,10 @@ export const pngIcon = createIcon(_jsxs("g", { strokeWidth: 1.25, children: [_js
|
|
|
241
254
|
export const magnetIcon = createIcon(_jsxs("g", { strokeWidth: 1.25, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0" }), _jsx("path", { d: "M4 8l5 0" }), _jsx("path", { d: "M15 8l4 0" })] }), tablerIconProps);
|
|
242
255
|
export const coffeeIcon = createIcon(_jsxs("g", { strokeWidth: 1.25, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1" }), _jsx("path", { d: "M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2" }), _jsx("path", { d: "M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2" }), _jsx("path", { d: "M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z" }), _jsx("path", { d: "M16.746 16.726a3 3 0 1 0 .252 -5.555" })] }), tablerIconProps);
|
|
243
256
|
export const DeviceDesktopIcon = createIcon(_jsxs("g", { stroke: "currentColor", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4" })] }), { ...tablerIconProps, strokeWidth: 1.5 });
|
|
244
|
-
//
|
|
245
|
-
export const
|
|
257
|
+
// login
|
|
258
|
+
export const loginIcon = createIcon(_jsxs("g", { strokeWidth: 1.5, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2" }), _jsx("path", { d: "M21 12h-13l3 -3" }), _jsx("path", { d: "M11 15l-3 -3" })] }), tablerIconProps);
|
|
246
259
|
export const youtubeIcon = createIcon(_jsxs("g", { children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z" }), _jsx("path", { d: "M10 9l5 3l-5 3z" })] }), tablerIconProps);
|
|
247
260
|
export const gridIcon = createIcon(_jsxs("g", { strokeWidth: 1.5, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M3 6h18" }), _jsx("path", { d: "M3 12h18" }), _jsx("path", { d: "M3 18h18" }), _jsx("path", { d: "M6 3v18" }), _jsx("path", { d: "M12 3v18" }), _jsx("path", { d: "M18 3v18" })] }), tablerIconProps);
|
|
261
|
+
export const lineEditorIcon = createIcon(_jsxs("g", { strokeWidth: 1.5, children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" }), _jsx("path", { d: "M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" }), _jsx("path", { d: "M17 5c-6.627 0 -12 5.373 -12 12" })] }), tablerIconProps);
|
|
262
|
+
export const collapseDownIcon = createIcon(_jsxs("g", { children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M6 9l6 6l6 -6" })] }), tablerIconProps);
|
|
263
|
+
export const collapseUpIcon = createIcon(_jsxs("g", { children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M6 15l6 -6l6 6" })] }), tablerIconProps);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppProps } from "./types";
|
|
2
|
-
import { ExcalidrawElement, FontFamilyValues } from "./element/types";
|
|
1
|
+
import type { AppProps } from "./types";
|
|
2
|
+
import type { ExcalidrawElement, FontFamilyValues } from "./element/types";
|
|
3
3
|
export declare const isDarwin: boolean;
|
|
4
4
|
export declare const isWindows: boolean;
|
|
5
5
|
export declare const isAndroid: boolean;
|
|
@@ -10,6 +10,7 @@ export declare const isIOS: boolean;
|
|
|
10
10
|
export declare const isBrave: () => boolean;
|
|
11
11
|
export declare const supportsResizeObserver: boolean;
|
|
12
12
|
export declare const APP_NAME = "Excalidraw";
|
|
13
|
+
export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
13
14
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
14
15
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
15
16
|
export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
@@ -279,3 +280,8 @@ export declare const EDITOR_LS_KEYS: {
|
|
|
279
280
|
* where filename is optional and we can't retrieve name from app state
|
|
280
281
|
*/
|
|
281
282
|
export declare const DEFAULT_FILENAME = "Untitled";
|
|
283
|
+
export declare const STATS_PANELS: {
|
|
284
|
+
readonly generalStats: 1;
|
|
285
|
+
readonly elementProperties: 2;
|
|
286
|
+
};
|
|
287
|
+
export declare const MIN_WIDTH_OR_HEIGHT = 1;
|
|
@@ -15,6 +15,11 @@ export const isIOS = /iPad|iPhone/.test(navigator.platform) ||
|
|
|
15
15
|
export const isBrave = () => navigator.brave?.isBrave?.name === "isBrave";
|
|
16
16
|
export const supportsResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
|
|
17
17
|
export const APP_NAME = "Excalidraw";
|
|
18
|
+
// distance when creating text before it's considered `autoResize: false`
|
|
19
|
+
// we're using higher threshold so that clicks that end up being drags
|
|
20
|
+
// don't unintentionally create text elements that are wrapped to a few chars
|
|
21
|
+
// (happens a lot with fast clicks with the text tool)
|
|
22
|
+
export const TEXT_AUTOWRAP_THRESHOLD = 36; // px
|
|
18
23
|
export const DRAGGING_THRESHOLD = 10; // px
|
|
19
24
|
export const LINE_CONFIRM_THRESHOLD = 8; // px
|
|
20
25
|
export const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
@@ -226,7 +231,7 @@ export const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
|
226
231
|
export const EXPORT_SCALES = [1, 2, 3];
|
|
227
232
|
export const DEFAULT_EXPORT_PADDING = 10; // px
|
|
228
233
|
export const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
229
|
-
export const MAX_ALLOWED_FILE_BYTES =
|
|
234
|
+
export const MAX_ALLOWED_FILE_BYTES = 4 * 1024 * 1024;
|
|
230
235
|
export const SVG_NS = "http://www.w3.org/2000/svg";
|
|
231
236
|
export const ENCRYPTION_KEY_BITS = 128;
|
|
232
237
|
export const VERSIONS = {
|
|
@@ -329,3 +334,5 @@ export const EDITOR_LS_KEYS = {
|
|
|
329
334
|
* where filename is optional and we can't retrieve name from app state
|
|
330
335
|
*/
|
|
331
336
|
export const DEFAULT_FILENAME = "Untitled";
|
|
337
|
+
export const STATS_PANELS = { generalStats: 1, elementProperties: 2 };
|
|
338
|
+
export const MIN_WIDTH_OR_HEIGHT = 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppState } from "./types";
|
|
1
|
+
import type { AppState } from "./types";
|
|
2
2
|
export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
|
|
3
3
|
export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
4
4
|
export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EDITOR_LS_KEYS } from "../constants";
|
|
2
|
-
import { JSONValue } from "../types";
|
|
1
|
+
import type { EDITOR_LS_KEYS } from "../constants";
|
|
2
|
+
import type { JSONValue } from "../types";
|
|
3
3
|
export declare class EditorLocalStorage {
|
|
4
4
|
static has(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): boolean;
|
|
5
5
|
static get<T extends JSONValue>(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): T | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
2
|
-
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
|
-
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
|
-
import { ValueOf } from "../utility-types";
|
|
5
|
-
import { FileSystemHandle } from "./filesystem";
|
|
6
|
-
import { ImportedLibraryData } from "./types";
|
|
2
|
+
import type { ExcalidrawElement, FileId } from "../element/types";
|
|
3
|
+
import type { AppState, DataURL, LibraryItem } from "../types";
|
|
4
|
+
import type { ValueOf } from "../utility-types";
|
|
5
|
+
import type { FileSystemHandle } from "./filesystem";
|
|
6
|
+
import type { ImportedLibraryData } from "./types";
|
|
7
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
8
8
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
9
9
|
export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FileSystemHandle
|
|
1
|
+
import type { FileSystemHandle } from "browser-fs-access";
|
|
2
|
+
import { supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
3
|
import { MIME_TYPES } from "../constants";
|
|
3
4
|
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
|
|
4
5
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
import { ExportType } from "../scene/types";
|
|
3
|
-
import { AppState, BinaryFiles } from "../types";
|
|
4
|
-
import { FileSystemHandle } from "./filesystem";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { ExportType } from "../scene/types";
|
|
3
|
+
import type { AppState, BinaryFiles } from "../types";
|
|
4
|
+
import type { FileSystemHandle } from "./filesystem";
|
|
5
5
|
export { loadFromBlob } from "./blob";
|
|
6
6
|
export { loadFromJSON, saveAsJSON } from "./json";
|
|
7
7
|
export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "../element/types";
|
|
2
|
-
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
|
-
import { ImportedDataState, ImportedLibraryData } from "./types";
|
|
1
|
+
import type { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
|
+
import type { ImportedDataState, ImportedLibraryData } from "./types";
|
|
4
4
|
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
|
|
5
5
|
export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, name?: string) => Promise<{
|
|
6
6
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|