@excalidraw/excalidraw 0.17.1-d9bbf1e → 0.17.1-e63dd02
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 +4 -0
- package/dist/browser/dev/excalidraw-assets-dev/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-XOM7LNOU.js → chunk-IT7T3AIK.js} +49 -8
- package/dist/browser/dev/excalidraw-assets-dev/chunk-IT7T3AIK.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-BLEB3M62.js → chunk-RNHSD5AR.js} +7668 -2142
- package/dist/browser/dev/excalidraw-assets-dev/chunk-RNHSD5AR.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{dist-ITJNUBZF.js → dist-DNSPZDOZ.js} +66 -32
- package/dist/browser/dev/excalidraw-assets-dev/dist-DNSPZDOZ.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js → en-XV7OZCPP.js} +8 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-ZGDDRBEN.js → image-77HZYGLG.js} +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-O66MQ7WQ.css → image-WDHYGKKP.css} +1 -1
- package/dist/browser/dev/excalidraw-assets-dev/{image-O66MQ7WQ.css.map → image-WDHYGKKP.css.map} +2 -2
- package/dist/browser/dev/index.css +610 -180
- package/dist/browser/dev/index.css.map +3 -3
- package/dist/browser/dev/index.js +13306 -8006
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/chunk-OYEADJSR.js +63 -0
- package/dist/browser/prod/excalidraw-assets/{chunk-5SYIAZGL.js → chunk-PDYFZJMS.js} +5 -5
- package/dist/browser/prod/excalidraw-assets/dist-NLUQPPQQ.js +7 -0
- package/dist/browser/prod/excalidraw-assets/en-YVAVVILW.js +1 -0
- package/dist/browser/prod/excalidraw-assets/image-X3GFZHNN.js +1 -0
- package/dist/browser/prod/index.css +1 -1
- package/dist/browser/prod/index.js +70 -51
- package/dist/dev/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
- package/dist/dev/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
- package/dist/dev/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
- package/dist/dev/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
- package/dist/dev/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
- package/dist/dev/{en-XW4JO6VX.json → en-YNVBSAIL.json} +42 -7
- package/dist/dev/index.css +610 -180
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +22165 -16833
- package/dist/dev/index.js.map +4 -4
- package/dist/excalidraw/actions/actionAddToLibrary.d.ts +24 -9
- package/dist/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/excalidraw/actions/actionBoundText.d.ts +20 -10
- package/dist/excalidraw/actions/actionBoundText.js +3 -1
- package/dist/excalidraw/actions/actionCanvas.d.ts +100 -40
- package/dist/excalidraw/actions/actionCanvas.js +1 -1
- package/dist/excalidraw/actions/actionClipboard.d.ts +62 -26
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +28 -12
- package/dist/excalidraw/actions/actionDeleteSelected.js +24 -5
- package/dist/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +3 -3
- package/dist/excalidraw/actions/actionDuplicateSelection.js +1 -2
- package/dist/excalidraw/actions/actionElementLock.d.ts +17 -7
- package/dist/excalidraw/actions/actionExport.d.ts +75 -30
- package/dist/excalidraw/actions/actionFinalize.d.ts +17 -7
- package/dist/excalidraw/actions/actionFinalize.js +2 -2
- package/dist/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/excalidraw/actions/actionFlip.js +2 -2
- package/dist/excalidraw/actions/actionFrame.d.ts +338 -10
- package/dist/excalidraw/actions/actionGroup.d.ts +324 -4
- package/dist/excalidraw/actions/actionHistory.d.ts +3 -3
- package/dist/excalidraw/actions/actionHistory.js +8 -8
- package/dist/excalidraw/actions/actionLinearEditor.d.ts +12 -5
- package/dist/excalidraw/actions/actionLinearEditor.js +21 -5
- package/dist/excalidraw/actions/actionLink.d.ts +8 -3
- package/dist/excalidraw/actions/actionMenu.d.ts +24 -9
- package/dist/excalidraw/actions/actionNavigate.d.ts +17 -7
- package/dist/excalidraw/actions/actionProperties.d.ts +476 -82
- package/dist/excalidraw/actions/actionProperties.js +384 -59
- package/dist/excalidraw/actions/actionSelectAll.d.ts +9 -4
- package/dist/excalidraw/actions/actionStyles.d.ts +12 -4
- package/dist/excalidraw/actions/actionStyles.js +3 -2
- package/dist/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
- package/dist/excalidraw/actions/actionTextAutoResize.js +38 -0
- package/dist/excalidraw/actions/actionToggleGridMode.d.ts +9 -4
- package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -3
- package/dist/excalidraw/actions/actionToggleStats.d.ts +9 -3
- package/dist/excalidraw/actions/actionToggleStats.js +4 -3
- package/dist/excalidraw/actions/actionToggleViewMode.d.ts +8 -3
- package/dist/excalidraw/actions/actionToggleZenMode.d.ts +8 -3
- 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/analytics.js +9 -7
- package/dist/excalidraw/animated-trail.d.ts +2 -2
- package/dist/excalidraw/appState.d.ts +6 -2
- package/dist/excalidraw/appState.js +14 -3
- package/dist/excalidraw/binaryheap.d.ts +12 -0
- package/dist/excalidraw/binaryheap.js +93 -0
- package/dist/excalidraw/change.d.ts +6 -5
- package/dist/excalidraw/change.js +20 -11
- package/dist/excalidraw/charts.d.ts +1 -1
- package/dist/excalidraw/charts.js +0 -10
- 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 +14 -9
- package/dist/excalidraw/components/App.d.ts +14 -17
- package/dist/excalidraw/components/App.js +356 -217
- package/dist/excalidraw/components/ButtonIcon.d.ts +15 -0
- package/dist/excalidraw/components/ButtonIcon.js +8 -0
- package/dist/excalidraw/components/ButtonIconSelect.js +2 -3
- package/dist/excalidraw/components/ButtonSeparator.d.ts +2 -0
- package/dist/excalidraw/components/ButtonSeparator.js +7 -0
- 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 +48 -80
- package/dist/excalidraw/components/ColorPicker/Picker.d.ts +3 -3
- package/dist/excalidraw/components/ColorPicker/Picker.js +1 -1
- 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/FontPicker/FontPicker.d.ts +21 -0
- package/dist/excalidraw/components/FontPicker/FontPicker.js +49 -0
- package/dist/excalidraw/components/FontPicker/FontPickerList.d.ts +25 -0
- package/dist/excalidraw/components/FontPicker/FontPickerList.js +119 -0
- package/dist/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +7 -0
- package/dist/excalidraw/components/FontPicker/FontPickerTrigger.js +13 -0
- package/dist/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +14 -0
- package/dist/excalidraw/components/FontPicker/keyboardNavHandlers.js +38 -0
- package/dist/excalidraw/components/HelpDialog.js +2 -2
- package/dist/excalidraw/components/HintViewer.d.ts +1 -1
- package/dist/excalidraw/components/HintViewer.js +6 -3
- 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/PropertiesPopover.d.ts +15 -0
- package/dist/excalidraw/components/PropertiesPopover.js +31 -0
- package/dist/excalidraw/components/PublishLibrary.d.ts +1 -1
- package/dist/excalidraw/components/QuickSearch.d.ts +9 -0
- package/dist/excalidraw/components/QuickSearch.js +8 -0
- package/dist/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/excalidraw/components/ScrollableList.d.ts +9 -0
- package/dist/excalidraw/components/ScrollableList.js +8 -0
- 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 +53 -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 +68 -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 +199 -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 +101 -0
- package/dist/excalidraw/components/Stats/Position.d.ts +13 -0
- package/dist/excalidraw/components/Stats/Position.js +40 -0
- package/dist/excalidraw/components/Stats/index.d.ts +16 -0
- package/dist/excalidraw/components/Stats/index.js +79 -0
- package/dist/excalidraw/components/Stats/utils.d.ts +26 -0
- package/dist/excalidraw/components/Stats/utils.js +162 -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 +5 -5
- package/dist/excalidraw/components/TTDDialog/common.js +3 -7
- 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/UserList.js +22 -22
- 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 +3 -2
- package/dist/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +12 -3
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +24 -4
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuItem.js +55 -14
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/excalidraw/components/dropdownMenu/DropdownMenuItemContent.js +2 -2
- package/dist/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/excalidraw/components/dropdownMenu/common.js +3 -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 +10 -2
- package/dist/excalidraw/components/icons.js +29 -6
- package/dist/excalidraw/components/main-menu/MainMenu.d.ts +12 -3
- package/dist/excalidraw/components/welcome-screen/WelcomeScreen.Center.js +2 -2
- package/dist/excalidraw/components/welcome-screen/WelcomeScreen.Hints.js +3 -3
- package/dist/excalidraw/constants.d.ts +24 -3
- package/dist/excalidraw/constants.js +28 -4
- 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/reconcile.js +18 -1
- package/dist/excalidraw/data/resave.d.ts +2 -2
- package/dist/excalidraw/data/restore.d.ts +3 -3
- package/dist/excalidraw/data/restore.js +58 -9
- package/dist/excalidraw/data/transform.d.ts +3 -3
- package/dist/excalidraw/data/transform.js +8 -5
- 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 +29 -10
- package/dist/excalidraw/element/binding.js +303 -71
- package/dist/excalidraw/element/bounds.d.ts +3 -3
- package/dist/excalidraw/element/collision.d.ts +4 -4
- package/dist/excalidraw/element/collision.js +5 -2
- package/dist/excalidraw/element/containerCache.d.ts +1 -1
- package/dist/excalidraw/element/dragElements.d.ts +6 -6
- package/dist/excalidraw/element/dragElements.js +39 -5
- package/dist/excalidraw/element/embeddable.d.ts +11 -6
- package/dist/excalidraw/element/heading.d.ts +11 -0
- package/dist/excalidraw/element/heading.js +81 -0
- 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 +27 -16
- package/dist/excalidraw/element/linearElementEditor.js +133 -56
- package/dist/excalidraw/element/mutateElement.d.ts +3 -3
- package/dist/excalidraw/element/mutateElement.js +5 -3
- package/dist/excalidraw/element/newElement.d.ts +12 -10
- package/dist/excalidraw/element/newElement.js +31 -16
- package/dist/excalidraw/element/resizeElements.d.ts +15 -6
- package/dist/excalidraw/element/resizeElements.js +122 -46
- package/dist/excalidraw/element/resizeTest.d.ts +4 -4
- package/dist/excalidraw/element/resizeTest.js +2 -4
- package/dist/excalidraw/element/routing.d.ts +13 -0
- package/dist/excalidraw/element/routing.js +641 -0
- 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 +6 -28
- package/dist/excalidraw/element/textElement.js +64 -112
- package/dist/excalidraw/element/textWysiwyg.d.ts +12 -6
- package/dist/excalidraw/element/textWysiwyg.js +75 -62
- package/dist/excalidraw/element/transformHandles.d.ts +3 -3
- package/dist/excalidraw/element/transformHandles.js +7 -12
- package/dist/excalidraw/element/typeChecks.d.ts +7 -4
- package/dist/excalidraw/element/typeChecks.js +17 -0
- package/dist/excalidraw/element/types.d.ts +22 -4
- package/dist/excalidraw/emitter.d.ts +1 -1
- package/dist/excalidraw/fonts/ExcalidrawFont.d.ts +21 -0
- package/dist/excalidraw/fonts/ExcalidrawFont.js +112 -0
- package/dist/excalidraw/fonts/index.d.ts +58 -0
- package/dist/excalidraw/fonts/index.js +240 -0
- package/dist/excalidraw/fonts/metadata.d.ts +36 -0
- package/dist/excalidraw/fonts/metadata.js +91 -0
- package/dist/excalidraw/fractionalIndex.d.ts +12 -5
- package/dist/excalidraw/fractionalIndex.js +40 -10
- package/dist/excalidraw/frame.d.ts +4 -4
- package/dist/excalidraw/frame.js +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 +8 -7
- package/dist/excalidraw/history.js +8 -8
- 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 +2 -2
- package/dist/excalidraw/index.js +3 -3
- package/dist/excalidraw/jotai.d.ts +1 -1
- package/dist/excalidraw/laser-trails.d.ts +3 -2
- package/dist/excalidraw/locales/en.json +42 -7
- package/dist/excalidraw/math.d.ts +47 -2
- package/dist/excalidraw/math.js +116 -0
- package/dist/excalidraw/mermaid.d.ts +2 -0
- package/dist/excalidraw/mermaid.js +29 -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 +64 -22
- package/dist/excalidraw/renderer/renderElement.d.ts +6 -4
- package/dist/excalidraw/renderer/renderElement.js +78 -58
- 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/renderer/staticSvgScene.js +2 -1
- 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 +26 -11
- package/dist/excalidraw/scene/Shape.d.ts +1 -1
- package/dist/excalidraw/scene/Shape.js +56 -5
- package/dist/excalidraw/scene/ShapeCache.d.ts +4 -4
- package/dist/excalidraw/scene/comparisons.d.ts +3 -2
- package/dist/excalidraw/scene/comparisons.js +1 -1
- package/dist/excalidraw/scene/export.d.ts +4 -3
- package/dist/excalidraw/scene/export.js +34 -36
- 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 +8 -0
- package/dist/excalidraw/shapes.js +57 -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 +32 -21
- package/dist/excalidraw/utils.d.ts +15 -5
- package/dist/excalidraw/utils.js +22 -0
- package/dist/excalidraw/zindex.d.ts +2 -2
- package/dist/prod/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
- package/dist/prod/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
- package/dist/prod/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
- package/dist/prod/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
- package/dist/prod/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
- package/dist/prod/{en-XW4JO6VX.json → en-YNVBSAIL.json} +42 -7
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +49 -53
- package/dist/utils/bbox.d.ts +2 -2
- package/dist/utils/collision.d.ts +1 -1
- package/dist/utils/export.d.ts +4 -3
- package/dist/utils/export.js +2 -1
- package/dist/utils/geometry/geometry.d.ts +3 -2
- package/dist/utils/geometry/geometry.js +5 -1
- package/dist/utils/geometry/shape.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/withinBounds.d.ts +1 -1
- package/history.ts +13 -6
- package/package.json +2 -2
- package/dist/browser/dev/Cascadia-CYPE3OJC.woff2 +0 -0
- package/dist/browser/dev/Virgil-UZN6MUT6.woff2 +0 -0
- package/dist/browser/dev/excalidraw-assets-dev/chunk-BLEB3M62.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/Cascadia-CYPE3OJC.woff2 +0 -0
- package/dist/browser/prod/Virgil-UZN6MUT6.woff2 +0 -0
- package/dist/browser/prod/excalidraw-assets/chunk-UWBW5SR2.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-35KQQ5EN.js +0 -1
- package/dist/dev/Cascadia-CYPE3OJC.woff2 +0 -0
- package/dist/dev/Virgil-UZN6MUT6.woff2 +0 -0
- package/dist/excalidraw/components/Stats.d.ts +0 -11
- package/dist/excalidraw/components/Stats.js +0 -13
- package/dist/excalidraw/scene/Fonts.d.ts +0 -21
- package/dist/excalidraw/scene/Fonts.js +0 -72
- package/dist/prod/Cascadia-CYPE3OJC.woff2 +0 -0
- package/dist/prod/Virgil-UZN6MUT6.woff2 +0 -0
- /package/dist/browser/dev/{Assistant-Bold-ZDZZ6JHA.woff2 → excalidraw-assets-dev/Assistant-Bold-ZDZZ6JHA.woff2} +0 -0
- /package/dist/browser/dev/{Assistant-Medium-DZ25RZU3.woff2 → excalidraw-assets-dev/Assistant-Medium-DZ25RZU3.woff2} +0 -0
- /package/dist/browser/dev/{Assistant-Regular-PLF2XOGW.woff2 → excalidraw-assets-dev/Assistant-Regular-PLF2XOGW.woff2} +0 -0
- /package/dist/browser/dev/{Assistant-SemiBold-CZ5MX6FK.woff2 → excalidraw-assets-dev/Assistant-SemiBold-CZ5MX6FK.woff2} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js.map → en-XV7OZCPP.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-ZGDDRBEN.js.map → image-77HZYGLG.js.map} +0 -0
- /package/dist/browser/prod/{Assistant-Bold-ZDZZ6JHA.woff2 → excalidraw-assets/Assistant-Bold-ZDZZ6JHA.woff2} +0 -0
- /package/dist/browser/prod/{Assistant-Medium-DZ25RZU3.woff2 → excalidraw-assets/Assistant-Medium-DZ25RZU3.woff2} +0 -0
- /package/dist/browser/prod/{Assistant-Regular-PLF2XOGW.woff2 → excalidraw-assets/Assistant-Regular-PLF2XOGW.woff2} +0 -0
- /package/dist/browser/prod/{Assistant-SemiBold-CZ5MX6FK.woff2 → excalidraw-assets/Assistant-SemiBold-CZ5MX6FK.woff2} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type Scene from "../scene/Scene";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawTextElement, FontFamilyValues } from "../element/types";
|
|
3
|
+
import { type FontMetadata } from "./metadata";
|
|
4
|
+
import { type Font } from "./ExcalidrawFont";
|
|
5
|
+
export declare class Fonts {
|
|
6
|
+
static readonly loadedFontsCache: Set<string>;
|
|
7
|
+
private static _registered;
|
|
8
|
+
private static _initialized;
|
|
9
|
+
static get registered(): Map<number, {
|
|
10
|
+
metadata: FontMetadata;
|
|
11
|
+
fonts: Font[];
|
|
12
|
+
}>;
|
|
13
|
+
get registered(): Map<number, {
|
|
14
|
+
metadata: FontMetadata;
|
|
15
|
+
fonts: Font[];
|
|
16
|
+
}>;
|
|
17
|
+
private readonly scene;
|
|
18
|
+
constructor({ scene }: {
|
|
19
|
+
scene: Scene;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* if we load a (new) font, it's likely that text elements using it have
|
|
23
|
+
* already been rendered using a fallback font. Thus, we want invalidate
|
|
24
|
+
* their shapes and rerender. See #637.
|
|
25
|
+
*
|
|
26
|
+
* Invalidates text elements and rerenders scene, provided that at least one
|
|
27
|
+
* of the supplied fontFaces has not already been processed.
|
|
28
|
+
*/
|
|
29
|
+
onLoaded: (fontFaces: readonly FontFace[]) => false | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Load font faces for a given scene and trigger scene update.
|
|
32
|
+
*/
|
|
33
|
+
loadSceneFonts: () => Promise<FontFace[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Gets all the font families for the given scene.
|
|
36
|
+
*/
|
|
37
|
+
getSceneFontFamilies: () => number[];
|
|
38
|
+
/**
|
|
39
|
+
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
40
|
+
*/
|
|
41
|
+
static loadFontsForElements: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
42
|
+
private static loadFontFaces;
|
|
43
|
+
/**
|
|
44
|
+
* WARN: should be called just once on init, even across multiple instances.
|
|
45
|
+
*/
|
|
46
|
+
private static init;
|
|
47
|
+
private static getFontFamilies;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Calculates vertical offset for a text with alphabetic baseline.
|
|
51
|
+
*/
|
|
52
|
+
export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["fontFamily"], fontSize: ExcalidrawTextElement["fontSize"], lineHeightPx: number) => number;
|
|
53
|
+
/**
|
|
54
|
+
* Gets line height forr a selected family.
|
|
55
|
+
*/
|
|
56
|
+
export declare const getLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
57
|
+
_brand: "unitlessLineHeight";
|
|
58
|
+
};
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { ShapeCache } from "../scene/ShapeCache";
|
|
2
|
+
import { isTextElement } from "../element";
|
|
3
|
+
import { getFontString } from "../utils";
|
|
4
|
+
import { FONT_FAMILY } from "../constants";
|
|
5
|
+
import { LOCAL_FONT_PROTOCOL, FONT_METADATA, RANGES, } from "./metadata";
|
|
6
|
+
import { ExcalidrawFont } from "./ExcalidrawFont";
|
|
7
|
+
import { getContainerElement } from "../element/textElement";
|
|
8
|
+
import Virgil from "./assets/Virgil-Regular.woff2";
|
|
9
|
+
import Excalifont from "./assets/Excalifont-Regular.woff2";
|
|
10
|
+
import Cascadia from "./assets/CascadiaCode-Regular.woff2";
|
|
11
|
+
import ComicShanns from "./assets/ComicShanns-Regular.woff2";
|
|
12
|
+
import LiberationSans from "./assets/LiberationSans-Regular.woff2";
|
|
13
|
+
import LilitaLatin from "https://fonts.gstatic.com/s/lilitaone/v15/i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2";
|
|
14
|
+
import LilitaLatinExt from "https://fonts.gstatic.com/s/lilitaone/v15/i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2";
|
|
15
|
+
import NunitoLatin from "https://fonts.gstatic.com/s/nunito/v26/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2";
|
|
16
|
+
import NunitoLatinExt from "https://fonts.gstatic.com/s/nunito/v26/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2";
|
|
17
|
+
import NunitoCyrilic from "https://fonts.gstatic.com/s/nunito/v26/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2";
|
|
18
|
+
import NunitoCyrilicExt from "https://fonts.gstatic.com/s/nunito/v26/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2";
|
|
19
|
+
import NunitoVietnamese from "https://fonts.gstatic.com/s/nunito/v26/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2";
|
|
20
|
+
export class Fonts {
|
|
21
|
+
// it's ok to track fonts across multiple instances only once, so let's use
|
|
22
|
+
// a static member to reduce memory footprint
|
|
23
|
+
static loadedFontsCache = new Set();
|
|
24
|
+
static _registered;
|
|
25
|
+
static _initialized = false;
|
|
26
|
+
static get registered() {
|
|
27
|
+
// lazy load the font registration
|
|
28
|
+
if (!Fonts._registered) {
|
|
29
|
+
Fonts._registered = Fonts.init();
|
|
30
|
+
}
|
|
31
|
+
else if (!Fonts._initialized) {
|
|
32
|
+
// case when host app register fonts before they are lazy loaded
|
|
33
|
+
// don't override whatever has been previously registered
|
|
34
|
+
Fonts._registered = new Map([
|
|
35
|
+
...Fonts.init().entries(),
|
|
36
|
+
...Fonts._registered.entries(),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
return Fonts._registered;
|
|
40
|
+
}
|
|
41
|
+
get registered() {
|
|
42
|
+
return Fonts.registered;
|
|
43
|
+
}
|
|
44
|
+
scene;
|
|
45
|
+
constructor({ scene }) {
|
|
46
|
+
this.scene = scene;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* if we load a (new) font, it's likely that text elements using it have
|
|
50
|
+
* already been rendered using a fallback font. Thus, we want invalidate
|
|
51
|
+
* their shapes and rerender. See #637.
|
|
52
|
+
*
|
|
53
|
+
* Invalidates text elements and rerenders scene, provided that at least one
|
|
54
|
+
* of the supplied fontFaces has not already been processed.
|
|
55
|
+
*/
|
|
56
|
+
onLoaded = (fontFaces) => {
|
|
57
|
+
if (
|
|
58
|
+
// bail if all fonts with have been processed. We're checking just a
|
|
59
|
+
// subset of the font properties (though it should be enough), so it
|
|
60
|
+
// can technically bail on a false positive.
|
|
61
|
+
fontFaces.every((fontFace) => {
|
|
62
|
+
const sig = `${fontFace.family}-${fontFace.style}-${fontFace.weight}-${fontFace.unicodeRange}`;
|
|
63
|
+
if (Fonts.loadedFontsCache.has(sig)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
Fonts.loadedFontsCache.add(sig);
|
|
67
|
+
return false;
|
|
68
|
+
})) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
let didUpdate = false;
|
|
72
|
+
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
73
|
+
for (const element of this.scene.getNonDeletedElements()) {
|
|
74
|
+
if (isTextElement(element)) {
|
|
75
|
+
didUpdate = true;
|
|
76
|
+
ShapeCache.delete(element);
|
|
77
|
+
const container = getContainerElement(element, elementsMap);
|
|
78
|
+
if (container) {
|
|
79
|
+
ShapeCache.delete(container);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (didUpdate) {
|
|
84
|
+
this.scene.triggerUpdate();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Load font faces for a given scene and trigger scene update.
|
|
89
|
+
*/
|
|
90
|
+
loadSceneFonts = async () => {
|
|
91
|
+
const sceneFamilies = this.getSceneFontFamilies();
|
|
92
|
+
const loaded = await Fonts.loadFontFaces(sceneFamilies);
|
|
93
|
+
this.onLoaded(loaded);
|
|
94
|
+
return loaded;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Gets all the font families for the given scene.
|
|
98
|
+
*/
|
|
99
|
+
getSceneFontFamilies = () => {
|
|
100
|
+
return Fonts.getFontFamilies(this.scene.getNonDeletedElements());
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
104
|
+
*/
|
|
105
|
+
static loadFontsForElements = async (elements) => {
|
|
106
|
+
const fontFamilies = Fonts.getFontFamilies(elements);
|
|
107
|
+
return await Fonts.loadFontFaces(fontFamilies);
|
|
108
|
+
};
|
|
109
|
+
static async loadFontFaces(fontFamilies) {
|
|
110
|
+
// add all registered font faces into the `document.fonts` (if not added already)
|
|
111
|
+
for (const { fonts, metadata } of Fonts.registered.values()) {
|
|
112
|
+
// skip registering font faces for local fonts (i.e. Helvetica)
|
|
113
|
+
if (metadata.local) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
for (const { fontFace } of fonts) {
|
|
117
|
+
if (!window.document.fonts.has(fontFace)) {
|
|
118
|
+
window.document.fonts.add(fontFace);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const loadedFontFaces = await Promise.all(fontFamilies.map(async (fontFamily) => {
|
|
123
|
+
const fontString = getFontString({
|
|
124
|
+
fontFamily,
|
|
125
|
+
fontSize: 16,
|
|
126
|
+
});
|
|
127
|
+
// WARN: without "text" param it does not have to mean that all font faces are loaded, instead it could be just one!
|
|
128
|
+
if (!window.document.fonts.check(fontString)) {
|
|
129
|
+
try {
|
|
130
|
+
// WARN: browser prioritizes loading only font faces with unicode ranges for characters which are present in the document (html & canvas), other font faces could stay unloaded
|
|
131
|
+
// we might want to retry here, i.e. in case CDN is down, but so far I didn't experience any issues - maybe it handles retry-like logic under the hood
|
|
132
|
+
return await window.document.fonts.load(fontString);
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
// don't let it all fail if just one font fails to load
|
|
136
|
+
console.error(`Failed to load font "${fontString}" from urls "${Fonts.registered
|
|
137
|
+
.get(fontFamily)
|
|
138
|
+
?.fonts.map((x) => x.urls)}"`, e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return Promise.resolve();
|
|
142
|
+
}));
|
|
143
|
+
return loadedFontFaces.flat().filter(Boolean);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* WARN: should be called just once on init, even across multiple instances.
|
|
147
|
+
*/
|
|
148
|
+
static init() {
|
|
149
|
+
const fonts = {
|
|
150
|
+
registered: new Map(),
|
|
151
|
+
};
|
|
152
|
+
// TODO: let's tweak this once we know how `register` will be exposed as part of the custom fonts API
|
|
153
|
+
const _register = register.bind(fonts);
|
|
154
|
+
_register("Virgil", FONT_METADATA[FONT_FAMILY.Virgil], {
|
|
155
|
+
uri: Virgil,
|
|
156
|
+
});
|
|
157
|
+
_register("Excalifont", FONT_METADATA[FONT_FAMILY.Excalifont], {
|
|
158
|
+
uri: Excalifont,
|
|
159
|
+
});
|
|
160
|
+
// keeping for backwards compatibility reasons, uses system font (Helvetica on MacOS, Arial on Win)
|
|
161
|
+
_register("Helvetica", FONT_METADATA[FONT_FAMILY.Helvetica], {
|
|
162
|
+
uri: LOCAL_FONT_PROTOCOL,
|
|
163
|
+
});
|
|
164
|
+
// used for server-side pdf & png export instead of helvetica (technically does not need metrics, but kept in for consistency)
|
|
165
|
+
_register("Liberation Sans", FONT_METADATA[FONT_FAMILY["Liberation Sans"]], {
|
|
166
|
+
uri: LiberationSans,
|
|
167
|
+
});
|
|
168
|
+
_register("Cascadia", FONT_METADATA[FONT_FAMILY.Cascadia], {
|
|
169
|
+
uri: Cascadia,
|
|
170
|
+
});
|
|
171
|
+
_register("Comic Shanns", FONT_METADATA[FONT_FAMILY["Comic Shanns"]], {
|
|
172
|
+
uri: ComicShanns,
|
|
173
|
+
});
|
|
174
|
+
_register("Lilita One", FONT_METADATA[FONT_FAMILY["Lilita One"]], { uri: LilitaLatinExt, descriptors: { unicodeRange: RANGES.LATIN_EXT } }, { uri: LilitaLatin, descriptors: { unicodeRange: RANGES.LATIN } });
|
|
175
|
+
_register("Nunito", FONT_METADATA[FONT_FAMILY.Nunito], {
|
|
176
|
+
uri: NunitoCyrilicExt,
|
|
177
|
+
descriptors: { unicodeRange: RANGES.CYRILIC_EXT, weight: "500" },
|
|
178
|
+
}, {
|
|
179
|
+
uri: NunitoCyrilic,
|
|
180
|
+
descriptors: { unicodeRange: RANGES.CYRILIC, weight: "500" },
|
|
181
|
+
}, {
|
|
182
|
+
uri: NunitoVietnamese,
|
|
183
|
+
descriptors: { unicodeRange: RANGES.VIETNAMESE, weight: "500" },
|
|
184
|
+
}, {
|
|
185
|
+
uri: NunitoLatinExt,
|
|
186
|
+
descriptors: { unicodeRange: RANGES.LATIN_EXT, weight: "500" },
|
|
187
|
+
}, {
|
|
188
|
+
uri: NunitoLatin,
|
|
189
|
+
descriptors: { unicodeRange: RANGES.LATIN, weight: "500" },
|
|
190
|
+
});
|
|
191
|
+
Fonts._initialized = true;
|
|
192
|
+
return fonts.registered;
|
|
193
|
+
}
|
|
194
|
+
static getFontFamilies(elements) {
|
|
195
|
+
return Array.from(elements.reduce((families, element) => {
|
|
196
|
+
if (isTextElement(element)) {
|
|
197
|
+
families.add(element.fontFamily);
|
|
198
|
+
}
|
|
199
|
+
return families;
|
|
200
|
+
}, new Set()));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Register a new font.
|
|
205
|
+
*
|
|
206
|
+
* @param family font family
|
|
207
|
+
* @param metadata font metadata
|
|
208
|
+
* @param params array of the rest of the FontFace parameters [uri: string, descriptors: FontFaceDescriptors?] ,
|
|
209
|
+
*/
|
|
210
|
+
function register(family, metadata, ...params) {
|
|
211
|
+
// TODO: likely we will need to abandon number "id" in order to support custom fonts
|
|
212
|
+
const familyId = FONT_FAMILY[family];
|
|
213
|
+
const registeredFamily = this.registered.get(familyId);
|
|
214
|
+
if (!registeredFamily) {
|
|
215
|
+
this.registered.set(familyId, {
|
|
216
|
+
metadata,
|
|
217
|
+
fonts: params.map(({ uri, descriptors }) => new ExcalidrawFont(family, uri, descriptors)),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return this.registered;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Calculates vertical offset for a text with alphabetic baseline.
|
|
224
|
+
*/
|
|
225
|
+
export const getVerticalOffset = (fontFamily, fontSize, lineHeightPx) => {
|
|
226
|
+
const { unitsPerEm, ascender, descender } = Fonts.registered.get(fontFamily)?.metadata.metrics ||
|
|
227
|
+
FONT_METADATA[FONT_FAMILY.Virgil].metrics;
|
|
228
|
+
const fontSizeEm = fontSize / unitsPerEm;
|
|
229
|
+
const lineGap = (lineHeightPx - fontSizeEm * ascender + fontSizeEm * descender) / 2;
|
|
230
|
+
const verticalOffset = fontSizeEm * ascender + lineGap;
|
|
231
|
+
return verticalOffset;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Gets line height forr a selected family.
|
|
235
|
+
*/
|
|
236
|
+
export const getLineHeight = (fontFamily) => {
|
|
237
|
+
const { lineHeight } = Fonts.registered.get(fontFamily)?.metadata.metrics ||
|
|
238
|
+
FONT_METADATA[FONT_FAMILY.Excalifont].metrics;
|
|
239
|
+
return lineHeight;
|
|
240
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Encapsulates font metrics with additional font metadata.
|
|
4
|
+
* */
|
|
5
|
+
export interface FontMetadata {
|
|
6
|
+
/** for head & hhea metrics read the woff2 with https://fontdrop.info/ */
|
|
7
|
+
metrics: {
|
|
8
|
+
/** head.unitsPerEm metric */
|
|
9
|
+
unitsPerEm: 1000 | 1024 | 2048;
|
|
10
|
+
/** hhea.ascender metric */
|
|
11
|
+
ascender: number;
|
|
12
|
+
/** hhea.descender metric */
|
|
13
|
+
descender: number;
|
|
14
|
+
/** harcoded unitless line-height, https://github.com/excalidraw/excalidraw/pull/6360#issuecomment-1477635971 */
|
|
15
|
+
lineHeight: number;
|
|
16
|
+
};
|
|
17
|
+
/** element to be displayed as an icon */
|
|
18
|
+
icon: JSX.Element;
|
|
19
|
+
/** flag to indicate a deprecated font */
|
|
20
|
+
deprecated?: true;
|
|
21
|
+
/** flag to indicate a server-side only font */
|
|
22
|
+
serverSide?: true;
|
|
23
|
+
/** flag to indiccate a local-only font */
|
|
24
|
+
local?: true;
|
|
25
|
+
}
|
|
26
|
+
export declare const FONT_METADATA: Record<number, FontMetadata>;
|
|
27
|
+
/** Unicode ranges */
|
|
28
|
+
export declare const RANGES: {
|
|
29
|
+
LATIN: string;
|
|
30
|
+
LATIN_EXT: string;
|
|
31
|
+
CYRILIC_EXT: string;
|
|
32
|
+
CYRILIC: string;
|
|
33
|
+
VIETNAMESE: string;
|
|
34
|
+
};
|
|
35
|
+
/** local protocol to skip the local font from registering or inlining */
|
|
36
|
+
export declare const LOCAL_FONT_PROTOCOL = "local:";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { FontFamilyCodeIcon, FontFamilyHeadingIcon, FontFamilyNormalIcon, FreedrawIcon, } from "../components/icons";
|
|
2
|
+
import { FONT_FAMILY } from "../constants";
|
|
3
|
+
export const FONT_METADATA = {
|
|
4
|
+
[FONT_FAMILY.Excalifont]: {
|
|
5
|
+
metrics: {
|
|
6
|
+
unitsPerEm: 1000,
|
|
7
|
+
ascender: 886,
|
|
8
|
+
descender: -374,
|
|
9
|
+
lineHeight: 1.25,
|
|
10
|
+
},
|
|
11
|
+
icon: FreedrawIcon,
|
|
12
|
+
},
|
|
13
|
+
[FONT_FAMILY.Nunito]: {
|
|
14
|
+
metrics: {
|
|
15
|
+
unitsPerEm: 1000,
|
|
16
|
+
ascender: 1011,
|
|
17
|
+
descender: -353,
|
|
18
|
+
lineHeight: 1.35,
|
|
19
|
+
},
|
|
20
|
+
icon: FontFamilyNormalIcon,
|
|
21
|
+
},
|
|
22
|
+
[FONT_FAMILY["Lilita One"]]: {
|
|
23
|
+
metrics: {
|
|
24
|
+
unitsPerEm: 1000,
|
|
25
|
+
ascender: 923,
|
|
26
|
+
descender: -220,
|
|
27
|
+
lineHeight: 1.15,
|
|
28
|
+
},
|
|
29
|
+
icon: FontFamilyHeadingIcon,
|
|
30
|
+
},
|
|
31
|
+
[FONT_FAMILY["Comic Shanns"]]: {
|
|
32
|
+
metrics: {
|
|
33
|
+
unitsPerEm: 1000,
|
|
34
|
+
ascender: 750,
|
|
35
|
+
descender: -250,
|
|
36
|
+
lineHeight: 1.25,
|
|
37
|
+
},
|
|
38
|
+
icon: FontFamilyCodeIcon,
|
|
39
|
+
},
|
|
40
|
+
[FONT_FAMILY.Virgil]: {
|
|
41
|
+
metrics: {
|
|
42
|
+
unitsPerEm: 1000,
|
|
43
|
+
ascender: 886,
|
|
44
|
+
descender: -374,
|
|
45
|
+
lineHeight: 1.25,
|
|
46
|
+
},
|
|
47
|
+
icon: FreedrawIcon,
|
|
48
|
+
deprecated: true,
|
|
49
|
+
},
|
|
50
|
+
[FONT_FAMILY.Helvetica]: {
|
|
51
|
+
metrics: {
|
|
52
|
+
unitsPerEm: 2048,
|
|
53
|
+
ascender: 1577,
|
|
54
|
+
descender: -471,
|
|
55
|
+
lineHeight: 1.15,
|
|
56
|
+
},
|
|
57
|
+
icon: FontFamilyNormalIcon,
|
|
58
|
+
deprecated: true,
|
|
59
|
+
local: true,
|
|
60
|
+
},
|
|
61
|
+
[FONT_FAMILY.Cascadia]: {
|
|
62
|
+
metrics: {
|
|
63
|
+
unitsPerEm: 2048,
|
|
64
|
+
ascender: 1900,
|
|
65
|
+
descender: -480,
|
|
66
|
+
lineHeight: 1.2,
|
|
67
|
+
},
|
|
68
|
+
icon: FontFamilyCodeIcon,
|
|
69
|
+
deprecated: true,
|
|
70
|
+
},
|
|
71
|
+
[FONT_FAMILY["Liberation Sans"]]: {
|
|
72
|
+
metrics: {
|
|
73
|
+
unitsPerEm: 2048,
|
|
74
|
+
ascender: 1854,
|
|
75
|
+
descender: -434,
|
|
76
|
+
lineHeight: 1.15,
|
|
77
|
+
},
|
|
78
|
+
icon: FontFamilyNormalIcon,
|
|
79
|
+
serverSide: true,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
/** Unicode ranges */
|
|
83
|
+
export const RANGES = {
|
|
84
|
+
LATIN: "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",
|
|
85
|
+
LATIN_EXT: "U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",
|
|
86
|
+
CYRILIC_EXT: "U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",
|
|
87
|
+
CYRILIC: "U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",
|
|
88
|
+
VIETNAMESE: "U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",
|
|
89
|
+
};
|
|
90
|
+
/** local protocol to skip the local font from registering or inlining */
|
|
91
|
+
export const LOCAL_FONT_PROTOCOL = "local:";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ExcalidrawElement, OrderedExcalidrawElement } from "./element/types";
|
|
1
|
+
import type { ExcalidrawElement, OrderedExcalidrawElement } from "./element/types";
|
|
2
2
|
/**
|
|
3
3
|
* Envisioned relation between array order and fractional indices:
|
|
4
4
|
*
|
|
5
5
|
* 1) Array (or array-like ordered data structure) should be used as a cache of elements order, hiding the internal fractional indices implementation.
|
|
6
|
-
* - it's undesirable to
|
|
6
|
+
* - it's undesirable to perform reorder for each related operation, therefore it's necessary to cache the order defined by fractional indices into an ordered data structure
|
|
7
7
|
* - it's easy enough to define the order of the elements from the outside (boundaries), without worrying about the underlying structure of fractional indices (especially for the host apps)
|
|
8
8
|
* - it's necessary to always keep the array support for backwards compatibility (restore) - old scenes, old libraries, supporting multiple excalidraw versions etc.
|
|
9
9
|
* - it's necessary to always keep the fractional indices in sync with the array order
|
|
10
10
|
* - elements with invalid indices should be detected and synced, without altering the already valid indices
|
|
11
11
|
*
|
|
12
12
|
* 2) Fractional indices should be used to reorder the elements, whenever the cached order is expected to be invalidated.
|
|
13
|
-
* - as the fractional indices are encoded as part of the elements, it opens up
|
|
14
|
-
* - re-order based on fractional indices should be part of (multiplayer) operations such as
|
|
13
|
+
* - as the fractional indices are encoded as part of the elements, it opens up possibilities for incremental-like APIs
|
|
14
|
+
* - re-order based on fractional indices should be part of (multiplayer) operations such as reconciliation & undo/redo
|
|
15
15
|
* - technically all the z-index actions could perform also re-order based on fractional indices,but in current state it would not bring much benefits,
|
|
16
16
|
* as it's faster & more efficient to perform re-order based on array manipulation and later synchronisation of moved indices with the array order
|
|
17
17
|
*/
|
|
@@ -20,7 +20,14 @@ import { ExcalidrawElement, OrderedExcalidrawElement } from "./element/types";
|
|
|
20
20
|
*
|
|
21
21
|
* @throws `InvalidFractionalIndexError` if invalid index is detected.
|
|
22
22
|
*/
|
|
23
|
-
export declare const validateFractionalIndices: (
|
|
23
|
+
export declare const validateFractionalIndices: (elements: readonly ExcalidrawElement[], { shouldThrow, includeBoundTextValidation, reconciliationContext, }: {
|
|
24
|
+
shouldThrow: boolean;
|
|
25
|
+
includeBoundTextValidation: boolean;
|
|
26
|
+
reconciliationContext?: {
|
|
27
|
+
localElements: ReadonlyArray<ExcalidrawElement>;
|
|
28
|
+
remoteElements: ReadonlyArray<ExcalidrawElement>;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}) => void;
|
|
24
31
|
/**
|
|
25
32
|
* Order the elements based on the fractional indices.
|
|
26
33
|
* - when fractional indices are identical, break the tie based on the element id
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { generateNKeysBetween } from "fractional-indexing";
|
|
2
2
|
import { mutateElement } from "./element/mutateElement";
|
|
3
3
|
import { InvalidFractionalIndexError } from "./errors";
|
|
4
|
+
import { hasBoundTextElement } from "./element/typeChecks";
|
|
5
|
+
import { getBoundTextElement } from "./element/textElement";
|
|
6
|
+
import { arrayToMap } from "./utils";
|
|
4
7
|
/**
|
|
5
8
|
* Envisioned relation between array order and fractional indices:
|
|
6
9
|
*
|
|
7
10
|
* 1) Array (or array-like ordered data structure) should be used as a cache of elements order, hiding the internal fractional indices implementation.
|
|
8
|
-
* - it's undesirable to
|
|
11
|
+
* - it's undesirable to perform reorder for each related operation, therefore it's necessary to cache the order defined by fractional indices into an ordered data structure
|
|
9
12
|
* - it's easy enough to define the order of the elements from the outside (boundaries), without worrying about the underlying structure of fractional indices (especially for the host apps)
|
|
10
13
|
* - it's necessary to always keep the array support for backwards compatibility (restore) - old scenes, old libraries, supporting multiple excalidraw versions etc.
|
|
11
14
|
* - it's necessary to always keep the fractional indices in sync with the array order
|
|
12
15
|
* - elements with invalid indices should be detected and synced, without altering the already valid indices
|
|
13
16
|
*
|
|
14
17
|
* 2) Fractional indices should be used to reorder the elements, whenever the cached order is expected to be invalidated.
|
|
15
|
-
* - as the fractional indices are encoded as part of the elements, it opens up
|
|
16
|
-
* - re-order based on fractional indices should be part of (multiplayer) operations such as
|
|
18
|
+
* - as the fractional indices are encoded as part of the elements, it opens up possibilities for incremental-like APIs
|
|
19
|
+
* - re-order based on fractional indices should be part of (multiplayer) operations such as reconciliation & undo/redo
|
|
17
20
|
* - technically all the z-index actions could perform also re-order based on fractional indices,but in current state it would not bring much benefits,
|
|
18
21
|
* as it's faster & more efficient to perform re-order based on array manipulation and later synchronisation of moved indices with the array order
|
|
19
22
|
*/
|
|
@@ -22,12 +25,38 @@ import { InvalidFractionalIndexError } from "./errors";
|
|
|
22
25
|
*
|
|
23
26
|
* @throws `InvalidFractionalIndexError` if invalid index is detected.
|
|
24
27
|
*/
|
|
25
|
-
export const validateFractionalIndices = (
|
|
28
|
+
export const validateFractionalIndices = (elements, { shouldThrow = false, includeBoundTextValidation = false, reconciliationContext, }) => {
|
|
29
|
+
const errorMessages = [];
|
|
30
|
+
const stringifyElement = (element) => `${element?.index}:${element?.id}:${element?.type}:${element?.isDeleted}:${element?.version}:${element?.versionNonce}`;
|
|
31
|
+
const indices = elements.map((x) => x.index);
|
|
26
32
|
for (const [i, index] of indices.entries()) {
|
|
27
33
|
const predecessorIndex = indices[i - 1];
|
|
28
34
|
const successorIndex = indices[i + 1];
|
|
29
35
|
if (!isValidFractionalIndex(index, predecessorIndex, successorIndex)) {
|
|
30
|
-
|
|
36
|
+
errorMessages.push(`Fractional indices invariant has been compromised: "${stringifyElement(elements[i - 1])}", "${stringifyElement(elements[i])}", "${stringifyElement(elements[i + 1])}"`);
|
|
37
|
+
}
|
|
38
|
+
// disabled by default, as we don't fix it
|
|
39
|
+
if (includeBoundTextValidation && hasBoundTextElement(elements[i])) {
|
|
40
|
+
const container = elements[i];
|
|
41
|
+
const text = getBoundTextElement(container, arrayToMap(elements));
|
|
42
|
+
if (text && text.index <= container.index) {
|
|
43
|
+
errorMessages.push(`Fractional indices invariant for bound elements has been compromised: "${stringifyElement(text)}", "${stringifyElement(container)}"`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (errorMessages.length) {
|
|
48
|
+
const error = new InvalidFractionalIndexError();
|
|
49
|
+
const additionalContext = [];
|
|
50
|
+
if (reconciliationContext) {
|
|
51
|
+
additionalContext.push("Additional reconciliation context:");
|
|
52
|
+
additionalContext.push(reconciliationContext.localElements.map((x) => stringifyElement(x)));
|
|
53
|
+
additionalContext.push(reconciliationContext.remoteElements.map((x) => stringifyElement(x)));
|
|
54
|
+
}
|
|
55
|
+
// report just once and with the stacktrace
|
|
56
|
+
console.error(errorMessages.join("\n\n"), error.stack, elements.map((x) => stringifyElement(x)), ...additionalContext);
|
|
57
|
+
if (shouldThrow) {
|
|
58
|
+
// if enabled, gather all the errors first, throw once
|
|
59
|
+
throw error;
|
|
31
60
|
}
|
|
32
61
|
}
|
|
33
62
|
};
|
|
@@ -62,8 +91,11 @@ export const syncMovedIndices = (elements, movedElements) => {
|
|
|
62
91
|
const indicesGroups = getMovedIndicesGroups(elements, movedElements);
|
|
63
92
|
// try generatating indices, throws on invalid movedElements
|
|
64
93
|
const elementsUpdates = generateIndices(elements, indicesGroups);
|
|
94
|
+
const elementsCandidates = elements.map((x) => elementsUpdates.has(x) ? { ...x, ...elementsUpdates.get(x) } : x);
|
|
65
95
|
// ensure next indices are valid before mutation, throws on invalid ones
|
|
66
|
-
validateFractionalIndices(
|
|
96
|
+
validateFractionalIndices(elementsCandidates,
|
|
97
|
+
// we don't autofix invalid bound text indices, hence don't include it in the validation
|
|
98
|
+
{ includeBoundTextValidation: false, shouldThrow: true });
|
|
67
99
|
// split mutation so we don't end up in an incosistent state
|
|
68
100
|
for (const [element, update] of elementsUpdates) {
|
|
69
101
|
mutateElement(element, update, false);
|
|
@@ -97,12 +129,10 @@ const getMovedIndicesGroups = (elements, movedElements) => {
|
|
|
97
129
|
const indicesGroups = [];
|
|
98
130
|
let i = 0;
|
|
99
131
|
while (i < elements.length) {
|
|
100
|
-
if (movedElements.has(elements[i].id)
|
|
101
|
-
!isValidFractionalIndex(elements[i]?.index, elements[i - 1]?.index, elements[i + 1]?.index)) {
|
|
132
|
+
if (movedElements.has(elements[i].id)) {
|
|
102
133
|
const indicesGroup = [i - 1, i]; // push the lower bound index as the first item
|
|
103
134
|
while (++i < elements.length) {
|
|
104
|
-
if (!
|
|
105
|
-
!isValidFractionalIndex(elements[i]?.index, elements[i - 1]?.index, elements[i + 1]?.index))) {
|
|
135
|
+
if (!movedElements.has(elements[i].id)) {
|
|
106
136
|
break;
|
|
107
137
|
}
|
|
108
138
|
indicesGroup.push(i);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
1
|
+
import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
+
import type { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
3
3
|
import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
|
-
import { ReadonlySetLike } from "./utility-types";
|
|
4
|
+
import type { ReadonlySetLike } from "./utility-types";
|
|
5
5
|
export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
6
|
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
|
|
7
7
|
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
@@ -59,5 +59,5 @@ export declare const omitGroupsContainingFrameLikes: (allElements: ElementsMapOr
|
|
|
59
59
|
*/
|
|
60
60
|
export declare const getTargetFrame: (element: ExcalidrawElement, elementsMap: ElementsMap, appState: StaticCanvasAppState) => import("./element/types").ExcalidrawFrameElement | import("./element/types").ExcalidrawMagicFrameElement | null;
|
|
61
61
|
export declare const isElementInFrame: (element: ExcalidrawElement, allElementsMap: ElementsMap, appState: StaticCanvasAppState) => boolean;
|
|
62
|
-
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement
|
|
62
|
+
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement) => string;
|
|
63
63
|
export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => NonDeletedExcalidrawElement[];
|
package/dist/excalidraw/frame.js
CHANGED
|
@@ -426,12 +426,12 @@ export const isElementInFrame = (element, allElementsMap, appState) => {
|
|
|
426
426
|
}
|
|
427
427
|
return false;
|
|
428
428
|
};
|
|
429
|
-
export const getFrameLikeTitle = (element
|
|
429
|
+
export const getFrameLikeTitle = (element) => {
|
|
430
430
|
// TODO name frames "AI" only if specific to AI frames
|
|
431
431
|
return element.name === null
|
|
432
432
|
? isFrameElement(element)
|
|
433
|
-
?
|
|
434
|
-
:
|
|
433
|
+
? "Frame"
|
|
434
|
+
: "AI Frame"
|
|
435
435
|
: element.name;
|
|
436
436
|
};
|
|
437
437
|
export const getElementsOverlappingFrame = (elements, frame) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ElementsMapOrArray, ElementsMap } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
|
-
import { Mutable } from "./utility-types";
|
|
1
|
+
import type { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ElementsMapOrArray, ElementsMap } from "./element/types";
|
|
2
|
+
import type { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
|
+
import type { Mutable } from "./utility-types";
|
|
4
4
|
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
|
|
5
5
|
export declare const selectGroupsForSelectedElements: {
|
|
6
6
|
(appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
|
|
@@ -29,5 +29,5 @@ export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["gro
|
|
|
29
29
|
}) => string[];
|
|
30
30
|
export declare const getMaximumGroups: (elements: ExcalidrawElement[], elementsMap: ElementsMap) => ExcalidrawElement[][];
|
|
31
31
|
export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<string>;
|
|
32
|
-
export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
|
|
32
|
+
export declare const elementsAreInSameGroup: (elements: readonly ExcalidrawElement[]) => boolean;
|
|
33
33
|
export declare const isInGroup: (element: NonDeletedExcalidrawElement) => boolean;
|