@excalidraw/math 0.18.0-b7aac689a → 0.18.0-c0a0ca3

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.
Files changed (386) hide show
  1. package/dist/dev/index.js +363 -163
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/appEventBus.d.ts +27 -0
  6. package/dist/types/common/src/bounds.d.ts +10 -0
  7. package/dist/types/common/src/colors.d.ts +81 -39
  8. package/dist/types/common/src/constants.d.ts +106 -33
  9. package/dist/types/common/src/editorInterface.d.ts +34 -0
  10. package/dist/types/common/src/font-metadata.d.ts +1 -3
  11. package/dist/types/common/src/index.d.ts +5 -0
  12. package/dist/types/common/src/keys.d.ts +7 -1
  13. package/dist/types/common/src/points.d.ts +1 -1
  14. package/dist/types/common/src/random.d.ts +7 -0
  15. package/dist/types/common/src/utility-types.d.ts +0 -1
  16. package/dist/types/common/src/utils.d.ts +58 -77
  17. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  18. package/dist/types/element/src/Scene.d.ts +18 -10
  19. package/dist/types/element/src/align.d.ts +6 -2
  20. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  21. package/dist/types/element/src/arrowheads.d.ts +3 -0
  22. package/dist/types/element/src/arrows/focus.d.ts +30 -0
  23. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  24. package/dist/types/element/src/binding.d.ts +145 -49
  25. package/dist/types/element/src/bounds.d.ts +35 -20
  26. package/dist/types/element/src/bucketFill.d.ts +110 -0
  27. package/dist/types/element/src/collision.d.ts +24 -3
  28. package/dist/types/element/src/comparisons.d.ts +10 -7
  29. package/dist/types/element/src/convertToShape.d.ts +23 -0
  30. package/dist/types/element/src/cropElement.d.ts +36 -4
  31. package/dist/types/element/src/delta.d.ts +45 -5
  32. package/dist/types/element/src/distribute.d.ts +7 -2
  33. package/dist/types/element/src/dragElements.d.ts +37 -5
  34. package/dist/types/element/src/duplicate.d.ts +67 -6
  35. package/dist/types/element/src/elbowArrow.d.ts +7 -0
  36. package/dist/types/element/src/embeddable.d.ts +3 -2
  37. package/dist/types/element/src/flowchart.d.ts +9 -11
  38. package/dist/types/element/src/fractionalIndex.d.ts +4 -4
  39. package/dist/types/element/src/frame.d.ts +35 -12
  40. package/dist/types/element/src/groups.d.ts +10 -14
  41. package/dist/types/element/src/heading.d.ts +2 -1
  42. package/dist/types/element/src/image.d.ts +6 -13
  43. package/dist/types/element/src/index.d.ts +12 -4
  44. package/dist/types/element/src/linearElementEditor.d.ts +53 -31
  45. package/dist/types/element/src/listMarker.d.ts +39 -0
  46. package/dist/types/element/src/mutateElement.d.ts +6 -2
  47. package/dist/types/element/src/newElement.d.ts +61 -9
  48. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  49. package/dist/types/element/src/renderElement.d.ts +33 -12
  50. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  51. package/dist/types/element/src/resizeElements.d.ts +24 -14
  52. package/dist/types/element/src/resizeTest.d.ts +6 -5
  53. package/dist/types/element/src/selection.d.ts +11 -17
  54. package/dist/types/element/src/shape.d.ts +38 -9
  55. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  56. package/dist/types/element/src/sortElements.d.ts +10 -0
  57. package/dist/types/element/src/stickyNote.d.ts +191 -0
  58. package/dist/types/element/src/store.d.ts +6 -1
  59. package/dist/types/element/src/textElement.d.ts +24 -12
  60. package/dist/types/element/src/textMeasurements.d.ts +16 -14
  61. package/dist/types/element/src/textWrapping.d.ts +28 -1
  62. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +32 -9
  63. package/dist/types/element/src/transformHandles.d.ts +8 -27
  64. package/dist/types/element/src/typeChecks.d.ts +30 -31
  65. package/dist/types/element/src/types.d.ts +55 -20
  66. package/dist/types/element/src/utils.d.ts +22 -6
  67. package/dist/types/element/src/zindex.d.ts +7 -1
  68. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +251 -222
  69. package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
  70. package/dist/types/excalidraw/actions/actionBoundText.d.ts +117 -274
  71. package/dist/types/excalidraw/actions/actionCanvas.d.ts +556 -1581
  72. package/dist/types/excalidraw/actions/actionClipboard.d.ts +179 -904
  73. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +74 -65
  74. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -565
  75. package/dist/types/excalidraw/actions/actionDeselect.d.ts +183 -0
  76. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
  77. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
  78. package/dist/types/excalidraw/actions/actionElementLink.d.ts +81 -78
  79. package/dist/types/excalidraw/actions/actionElementLock.d.ts +151 -132
  80. package/dist/types/excalidraw/actions/actionExport.d.ts +232 -1425
  81. package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -395
  82. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  83. package/dist/types/excalidraw/actions/actionFrame.d.ts +253 -879
  84. package/dist/types/excalidraw/actions/actionGroup.d.ts +162 -151
  85. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +245 -191
  86. package/dist/types/excalidraw/actions/actionLink.d.ts +87 -78
  87. package/dist/types/excalidraw/actions/actionMenu.d.ts +76 -441
  88. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -361
  89. package/dist/types/excalidraw/actions/actionProperties.d.ts +240 -2548
  90. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +81 -76
  91. package/dist/types/excalidraw/actions/actionStyles.d.ts +75 -65
  92. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
  93. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +196 -0
  94. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +89 -81
  95. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +196 -0
  96. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
  97. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +88 -79
  98. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +77 -75
  99. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
  100. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
  101. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +87 -78
  102. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +88 -79
  103. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  104. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +88 -79
  105. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  106. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  107. package/dist/types/excalidraw/actions/index.d.ts +8 -3
  108. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  109. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  110. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  111. package/dist/types/excalidraw/actions/types.d.ts +11 -7
  112. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  113. package/dist/types/excalidraw/appState.d.ts +60 -28
  114. package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
  115. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  116. package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
  117. package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
  118. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  119. package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
  120. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  121. package/dist/types/excalidraw/charts/index.d.ts +8 -0
  122. package/dist/types/excalidraw/clipboard.d.ts +57 -19
  123. package/dist/types/excalidraw/components/Actions.d.ts +40 -14
  124. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  125. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  126. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  127. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  128. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  129. package/dist/types/excalidraw/components/App.d.ts +424 -157
  130. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  131. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  132. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  133. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  134. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  135. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  136. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  137. package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
  138. package/dist/types/excalidraw/components/App.text.d.ts +197 -0
  139. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  140. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  141. package/dist/types/excalidraw/components/App.viewport.d.ts +133 -0
  142. package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
  143. package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
  144. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  145. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  146. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  147. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
  148. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  149. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
  150. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
  151. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
  152. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  153. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
  154. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  155. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  156. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  157. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  158. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  159. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +6 -5
  160. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  161. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  162. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  163. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  164. package/dist/types/excalidraw/components/Ellipsify.d.ts +3 -0
  165. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  166. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
  167. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  168. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  169. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
  170. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  171. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  172. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  173. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  174. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  175. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  176. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  177. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  178. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  179. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  180. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  181. package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
  182. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  183. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  184. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  185. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
  186. package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
  187. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  188. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  189. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  190. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  191. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  192. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  193. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  194. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  195. package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
  196. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  197. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  198. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  199. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  200. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  201. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  202. package/dist/types/excalidraw/components/Popover.d.ts +2 -3
  203. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  204. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  205. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  206. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  207. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  208. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  209. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  210. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  211. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
  212. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  213. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  214. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  215. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  216. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  217. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  218. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  219. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  220. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  221. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  222. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
  223. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  224. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  225. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  226. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  227. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  228. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  229. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  230. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  231. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  232. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  233. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  234. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  235. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  236. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +4 -2
  237. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  238. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  239. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  240. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +9 -3
  241. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  242. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  243. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  244. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  245. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +12 -0
  246. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  247. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +10 -0
  248. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +19 -16
  249. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  250. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  251. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +8 -0
  252. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  253. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +108 -0
  254. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  255. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  256. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  257. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
  258. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  259. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  260. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  261. package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
  262. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  263. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  264. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  265. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  266. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  267. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  268. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  269. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  270. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  271. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +11 -4
  272. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  273. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  274. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  275. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  276. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  277. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  278. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  279. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  280. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  281. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  282. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  283. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  284. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  285. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  286. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  287. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  288. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  289. package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
  290. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  291. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  292. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +16 -5
  293. package/dist/types/excalidraw/components/icons.d.ts +57 -22
  294. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +27 -3
  295. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  296. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  297. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  298. package/dist/types/excalidraw/data/blob.d.ts +375 -12
  299. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  300. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  301. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  302. package/dist/types/excalidraw/data/index.d.ts +11 -12
  303. package/dist/types/excalidraw/data/json.d.ts +193 -3
  304. package/dist/types/excalidraw/data/library.d.ts +25 -10
  305. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  306. package/dist/types/excalidraw/data/restore.d.ts +27 -7
  307. package/dist/types/excalidraw/data/types.d.ts +4 -1
  308. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  309. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  310. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  311. package/dist/types/excalidraw/errors.d.ts +14 -0
  312. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  313. package/dist/types/excalidraw/history.d.ts +10 -4
  314. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  315. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
  316. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  317. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  318. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  319. package/dist/types/excalidraw/i18n.d.ts +2 -2
  320. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  321. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  322. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  323. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  324. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  325. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  326. package/dist/types/excalidraw/renderer/animation.d.ts +23 -0
  327. package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
  328. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
  329. package/dist/types/excalidraw/renderer/staticScene.d.ts +15 -7
  330. package/dist/types/excalidraw/scene/Renderer.d.ts +492 -20
  331. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  332. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  333. package/dist/types/excalidraw/scene/types.d.ts +51 -9
  334. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  335. package/dist/types/excalidraw/snapping.d.ts +12 -12
  336. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  337. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  338. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  339. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  340. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  341. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  342. package/dist/types/excalidraw/types.d.ts +734 -64
  343. package/dist/types/excalidraw/viewport.d.ts +303 -0
  344. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +19 -5
  345. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  346. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  347. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  348. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  349. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  350. package/dist/types/math/src/constants.d.ts +0 -1
  351. package/dist/types/math/src/curve.d.ts +23 -13
  352. package/dist/types/math/src/index.d.ts +1 -0
  353. package/dist/types/math/src/pca.d.ts +79 -0
  354. package/dist/types/math/src/point.d.ts +8 -2
  355. package/dist/types/math/src/polygon.d.ts +26 -2
  356. package/dist/types/math/src/range.d.ts +1 -3
  357. package/dist/types/math/src/segment.d.ts +10 -3
  358. package/dist/types/math/src/types.d.ts +25 -1
  359. package/dist/types/utils/src/index.d.ts +4 -3
  360. package/dist/types/utils/src/shape.d.ts +8 -8
  361. package/package.json +2 -2
  362. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -186
  363. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  364. package/dist/types/excalidraw/charts.d.ts +0 -27
  365. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  366. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  367. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  368. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  369. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  370. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  371. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  372. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  373. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  374. package/dist/types/excalidraw/components/shapes.d.ts +0 -62
  375. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  376. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  377. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  378. package/dist/types/excalidraw/cursor.d.ts +0 -5
  379. package/dist/types/excalidraw/data/reconcile.d.ts +0 -6
  380. package/dist/types/excalidraw/index.d.ts +0 -46
  381. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  382. package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
  383. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  384. package/dist/types/utils/src/bbox.d.ts +0 -9
  385. package/dist/types/utils/src/export.d.ts +0 -35
  386. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,68 +1,155 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
- import type { LocalPoint } from "@excalidraw/math";
3
- import type { AppState } from "@excalidraw/excalidraw/types";
2
+ import type { LineSegment, LocalPoint } from "@excalidraw/math";
3
+ import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
4
+ import type { Bounds } from "@excalidraw/common";
4
5
  import { type Heading } from "./heading";
6
+ import type { RenderEnvironment } from "./renderEnvironment";
5
7
  import type { Scene } from "./Scene";
6
- import type { Bounds } from "./bounds";
7
8
  import type { ElementUpdate } from "./mutateElement";
8
- import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
9
- export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
- export type SuggestedPointBinding = [
11
- NonDeleted<ExcalidrawLinearElement>,
12
- "start" | "end" | "both",
13
- NonDeleted<ExcalidrawBindableElement>
14
- ];
15
- export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
16
- export declare const isBindingEnabled: (appState: AppState) => boolean;
17
- export declare const FIXED_BINDING_DISTANCE = 5;
18
- export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
19
- export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
20
- export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
21
- export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
22
- export declare const maybeSuggestBindingsForLinearElementAtCoords: (linearElement: NonDeleted<ExcalidrawLinearElement>, pointerCoords: {
23
- x: number;
24
- y: number;
25
- }[], scene: Scene, zoom: AppState["zoom"], oppositeBindingBoundElement?: ExcalidrawBindableElement | null) => ExcalidrawBindableElement[];
26
- export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
27
- x: number;
28
- y: number;
29
- }, scene: Scene) => void;
30
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
31
- export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
32
- export declare const getHoveredElementForBinding: (pointerCoords: {
9
+ import type { BindMode, ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, ExcalidrawElbowArrowElement, ExcalidrawElement, FixedPoint, FixedPointBinding, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered, PointsPositionUpdates } from "./types";
10
+ export type BindingStrategy = {
11
+ mode: BindMode;
12
+ element: NonDeleted<ExcalidrawBindableElement>;
13
+ focusPoint: GlobalPoint;
14
+ } | {
15
+ mode: null;
16
+ element?: undefined;
17
+ focusPoint?: undefined;
18
+ } | {
19
+ mode: undefined;
20
+ element?: undefined;
21
+ focusPoint?: undefined;
22
+ };
23
+ /**
24
+ * gaps exclude element strokeWidth
25
+ *
26
+ * IMPORTANT: currently must be > 0 (this also applies to the computed gap)
27
+ */
28
+ export declare const BASE_BINDING_GAP = 5;
29
+ export declare const BASE_ARROW_MIN_LENGTH = 10;
30
+ export declare const FOCUS_POINT_SIZE: number;
31
+ export declare const getBindingGap: (bindTarget: Pick<ExcalidrawBindableElement, "strokeWidth">) => number;
32
+ export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
33
+ export declare const isBindingEnabled: (appState: {
34
+ isBindingEnabled: AppState["isBindingEnabled"];
35
+ }) => boolean;
36
+ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, scenePointerX: number, scenePointerY: number, scene: Scene, appState: AppState, opts?: {
37
+ newArrow?: boolean;
38
+ altKey?: boolean;
39
+ angleLocked?: boolean;
40
+ initialBinding?: boolean;
41
+ gridSize?: NullableGridSize;
42
+ }) => {
43
+ start: BindingStrategy;
44
+ end: BindingStrategy;
45
+ };
46
+ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, screenPointerX: number, screenPointerY: number, elementsMap: NonDeletedSceneElementsMap, elements: readonly Ordered<NonDeletedExcalidrawElement>[], appState: AppState, opts?: {
47
+ newArrow?: boolean;
48
+ angleLocked?: boolean;
49
+ altKey?: boolean;
50
+ finalize?: boolean;
51
+ initialBinding?: boolean;
52
+ gridSize?: NullableGridSize;
53
+ }) => {
54
+ start: BindingStrategy;
55
+ end: BindingStrategy;
56
+ };
57
+ export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
58
+ export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, zoom: AppState["zoom"], focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => void;
59
+ /**
60
+ * Whether the arrow's end is bound to an element it's beyond the binding area
61
+ * of, i.e. that it couldn't be bound to in the editor (e.g. a participant's
62
+ * header in a sequence diagram, as laid out by mermaid)
63
+ */
64
+ export declare const isEndBoundBeyondBindingArea: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => boolean;
65
+ /**
66
+ * Extends the arrow's bound end along its end segment, by the segment's length
67
+ * (at least MIN_BOUND_END_EXTENSION), to find where it would reach the element
68
+ * it's bound to, off the element by the binding gap. Moving the end there
69
+ * restores bindings given to arrows that just fall short of their elements.
70
+ *
71
+ * @returns where to move the end to, or null if it doesn't reach the element
72
+ */
73
+ export declare const getBoundEndExtension: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => GlobalPoint | null;
74
+ export declare const unbindBindingElement: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
75
+ export declare const reanchorBindingsToOutline: (changedElement: NonDeleted<ExcalidrawBindableElement>, scene: Scene, zoom: AppState["zoom"]) => void;
76
+ /**
77
+ * Places both bound ends of `arrow` where its bindings put them on the elements
78
+ * in `elementsMap` they're bound to, and rewraps its label along it as placed.
79
+ * Leaves the label's x/y as they were (the editor derives arrow labels' x/y as
80
+ * it renders them), so callers returning the elements as data must store them
81
+ * (see `LinearElementEditor.getBoundTextElementPosition`).
82
+ */
83
+ export declare const updateBoundArrow: (arrow: NonDeleted<ExcalidrawArrowElement>, scene: Scene, elementsMap: ElementsMap,
84
+ /** measures the arrow's label */
85
+ renderEnvironment?: RenderEnvironment,
86
+ /**
87
+ * whether it's placed as what it's bound to moved: an arrow bound to one
88
+ * element at both ends then moves with it whole (its midpoints with its
89
+ * start), rather than only at its ends
90
+ */
91
+ boundElementMoved?: boolean) => void;
92
+ /** Whether `arrow` is bound to an element not in `elementIds`. */
93
+ export declare const isBoundToElementNotIn: (arrow: ExcalidrawArrowElement, elementIds: ReadonlySet<ExcalidrawElement["id"]>) => boolean;
94
+ /**
95
+ * The arrows that move with a frame being moved (with `movedElements`) but are
96
+ * bound to elements that don't (e.g. in other frames). They must neither be
97
+ * unbound, nor be left for what they're bound to to move: move everything
98
+ * else without them, and then them, with `moveFrameArrows()`.
99
+ *
100
+ * @param movedElements all the elements moving, frames included
101
+ */
102
+ export declare const getFrameArrowIdsToReattach: (movedElements: readonly ExcalidrawElement[]) => ReadonlySet<ExcalidrawElement["id"]>;
103
+ /**
104
+ * Moves the arrows (see `getFrameArrowIdsToReattach()`) by `offset` from where
105
+ * they were in `originalElements` (from where they are, without it), and puts
106
+ * their bound ends on what they're bound to: an end bound to a moved element
107
+ * thus follows it, and one bound to an unmoved element stays. Call it once
108
+ * everything else has moved.
109
+ */
110
+ export declare const moveFrameArrows: (arrowIds: ReadonlySet<ExcalidrawElement["id"]>, offset: {
33
111
  x: number;
34
112
  y: number;
35
- }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
113
+ }, scene: Scene, opts?: {
114
+ originalElements?: ElementsMap;
115
+ /** measures the arrows' labels */
116
+ renderEnvironment?: RenderEnvironment;
117
+ }) => void;
36
118
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
37
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
38
- newSize?: {
39
- width: number;
40
- height: number;
41
- };
119
+ /** see `getSimultaneouslyUpdatedElementIds` for how to pass it */
120
+ simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
42
121
  changedElements?: Map<string, ExcalidrawElement>;
122
+ /** measures the labels of the arrows it updates (the host's, in the editor) */
123
+ renderEnvironment?: RenderEnvironment;
43
124
  }) => void;
44
- export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
45
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
125
+ export declare const updateBindings: (latestElement: NonDeletedExcalidrawElement, scene: Scene, appState: AppState, options?: {
126
+ simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
46
127
  newSize?: {
47
128
  width: number;
48
129
  height: number;
49
130
  };
50
- zoom?: AppState["zoom"];
131
+ /** measures the labels of the bound arrows it updates */
132
+ renderEnvironment?: RenderEnvironment;
51
133
  }) => void;
134
+ /**
135
+ * The id set of `simultaneouslyUpdated`, shared by every `updateBoundElements()`
136
+ * call given the same array. Pass one array instance for all elements of an
137
+ * operation, and don't change its membership after the first lookup, or the
138
+ * cached ids go stale.
139
+ */
140
+ export declare const getSimultaneouslyUpdatedElementIds: (simultaneouslyUpdated: readonly ExcalidrawElement[] | undefined) => ReadonlySet<ExcalidrawElement["id"]>;
52
141
  export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
53
- export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => GlobalPoint;
54
- export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
55
- export declare const snapToMid: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number) => GlobalPoint;
56
- export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
142
+ export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"], customIntersector?: LineSegment<GlobalPoint>, isMidpointSnappingEnabled?: boolean) => GlobalPoint;
143
+ export declare const avoidRectangularCorner: (arrowElement: ExcalidrawArrowElement, bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
144
+ export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "startBinding" | "endBinding", binding: FixedPointBinding | null | undefined, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, dragging?: boolean) => LocalPoint | null;
145
+ export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"], shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => {
146
+ fixedPoint: FixedPoint;
147
+ };
148
+ export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
57
149
  fixedPoint: FixedPoint;
58
150
  };
59
151
  export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
60
152
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
61
- export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
62
- x: number;
63
- y: number;
64
- }, elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => boolean;
65
- export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number, zoom?: AppState["zoom"]) => number;
66
153
  export declare const bindingProperties: Set<BindableProp | BindingProp>;
67
154
  export type BindableProp = "boundElements";
68
155
  export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
@@ -104,7 +191,16 @@ export declare class BindableElement {
104
191
  */
105
192
  static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
106
193
  }
107
- export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
108
- export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
194
+ export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: FixedPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
195
+ export declare const getGlobalFixedPoints: (arrow: ExcalidrawArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
109
196
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
110
- export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
197
+ export declare const isFixedPoint: (fixedPoint: any) => fixedPoint is FixedPointBinding["fixedPoint"];
198
+ export declare const normalizeFixedPoint: <T extends FixedPoint>(fixedPoint: T) => FixedPoint;
199
+ export declare const getBindingSideMidPoint: (binding: FixedPointBinding, elementsMap: ElementsMap) => GlobalPoint | LocalPoint | null;
200
+ /**
201
+ * Binds an arrow endpoint to an explicit fixed point on a bindable element,
202
+ * bypassing the "derive the ratio from where the endpoint currently is"
203
+ * strategy used when dragging. Needed when the binding target is placed to fit
204
+ * the arrow rather than the other way round.
205
+ */
206
+ export declare const bindBindingElementToFixedPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, bindableElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", fixedPoint: FixedPoint, scene: Scene) => void;
@@ -1,7 +1,8 @@
1
+ import { type Bounds } from "@excalidraw/common";
1
2
  import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
2
3
  import type { AppState } from "@excalidraw/excalidraw/types";
3
4
  import type { Drawable, Op } from "roughjs/bin/core";
4
- import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
5
+ import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
5
6
  export type RectangleBox = {
6
7
  x: number;
7
8
  y: number;
@@ -9,15 +10,6 @@ export type RectangleBox = {
9
10
  height: number;
10
11
  angle: number;
11
12
  };
12
- /**
13
- * x and y position of top left corner, x and y position of bottom right corner
14
- */
15
- export type Bounds = readonly [
16
- minX: number,
17
- minY: number,
18
- maxX: number,
19
- maxY: number
20
- ];
21
13
  export type SceneBounds = readonly [
22
14
  sceneX: number,
23
15
  sceneY: number,
@@ -45,25 +37,27 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
45
37
  export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
46
38
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
47
39
  export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
48
- export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((p: GlobalPoint) => GlobalPoint) | undefined) => Bounds;
49
- export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
40
+ export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: (p: GlobalPoint) => GlobalPoint) => Bounds;
41
+ export declare const getBoundsFromPoints: <P extends GlobalPoint | LocalPoint>(points: readonly P[], padding?: number) => Bounds;
42
+ export declare const CARDINALITY_ONE_OR_MANY_BAR_OFFSET = -0.25;
43
+ export declare const CARDINALITY_INNER_BAR_OFFSET = -0.5;
44
+ export declare const CARDINALITY_ZERO_CIRCLE_OFFSET = 1.5;
45
+ export declare const CARDINALITY_ZERO_CIRCLE_SCALE = 0.8;
50
46
  /** @returns number in pixels */
51
47
  export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
52
48
  /** @returns number in degrees */
53
- export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
54
- export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
49
+ export declare const getArrowheadAngle: (arrowhead: Arrowhead,
50
+ /** size the arrowhead is drawn at, if scaled down */
51
+ size?: number) => Degrees;
52
+ export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead, offsetMultiplier?: number) => number[] | null;
55
53
  export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
56
54
  export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
57
- export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
55
+ export declare const getDraggedElementsBounds: (elements: readonly NonDeletedExcalidrawElement[], dragOffset: {
58
56
  x: number;
59
57
  y: number;
60
58
  }) => number[];
61
59
  export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => Bounds;
62
60
  export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => Bounds;
63
- export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
64
- x: number;
65
- y: number;
66
- }) => Bounds;
67
61
  export interface BoundingBox {
68
62
  minX: number;
69
63
  minY: number;
@@ -74,7 +68,7 @@ export interface BoundingBox {
74
68
  width: number;
75
69
  height: number;
76
70
  }
77
- export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
71
+ export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
78
72
  /**
79
73
  * returns scene coords of user's editor viewport (visible canvas area) bounds
80
74
  */
@@ -85,5 +79,26 @@ export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
85
79
  */
86
80
  export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
87
81
  export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
82
+ export declare const pointInsideBoundsInclusive: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
88
83
  export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
84
+ export declare const boundsContainBounds: (outerBounds: Bounds, innerBounds: Bounds) => boolean;
85
+ /**
86
+ * High level helper to get elements overlapping a bounding box.
87
+ * It can be used to get elements overlapping a selection box, for example.
88
+ *
89
+ */
90
+ export declare const elementsOverlappingBBox: <T extends ExcalidrawElement>({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, includeStroke, }: {
91
+ elements: readonly T[];
92
+ elementsMap?: ElementsMap;
93
+ bounds: Bounds | ExcalidrawElement;
94
+ /**
95
+ * - overlap: elements overlapping or inside bounds
96
+ * - contain: elements inside bounds
97
+ **/
98
+ type: "contain" | "overlap";
99
+ excludeElementsInFrames?: boolean;
100
+ shouldIgnoreElementFromSelection?: (element: T) => boolean;
101
+ /** whether elements extend by their stroke, as they render */
102
+ includeStroke?: boolean;
103
+ }) => T[];
89
104
  export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
@@ -0,0 +1,110 @@
1
+ import type { GlobalPoint } from "@excalidraw/math";
2
+ import type { ElementsMap, ExcalidrawElement, ExcalidrawLineElement, NonDeletedExcalidrawElement } from "./types";
3
+ export type BucketFillOptions = {
4
+ /**
5
+ * geometric fidelity: vertices closer than this collapse to the same graph
6
+ * node, and a node this close to a stroke splits it (T-junction). Keep
7
+ * SMALL — every merge can relocate a vertex by up to this distance, so
8
+ * this value is the upper bound on how far the filled shape may deviate
9
+ * from the actual strokes.
10
+ */
11
+ snapEpsilon: number;
12
+ /**
13
+ * connectivity: loose stroke ends within this distance of another stroke
14
+ * are bridged with a connector edge so the region reads as closed. Also
15
+ * used as broad-phase padding around the owner bounds. Unlike
16
+ * `snapEpsilon` this does not affect the shape's fidelity (bridges add
17
+ * edges; they never move existing vertices).
18
+ */
19
+ gapTolerance: number;
20
+ /** discard faces / polygons smaller than this absolute area */
21
+ minArea: number;
22
+ /** bail out with `too_complex` above this many input segments */
23
+ maxBoundarySegments: number;
24
+ /** cap on the number of generated polygon points */
25
+ maxGeneratedPoints: number;
26
+ /**
27
+ * initial half-extent of the owner-less search box around the click
28
+ * (doubles up to 3 times while the found face touches the box frontier)
29
+ */
30
+ fallbackSearchRadius: number;
31
+ };
32
+ export declare const DEFAULT_BUCKET_FILL_OPTIONS: BucketFillOptions;
33
+ export type BucketFillFailureReason = "no_owner" | "open_region" | "too_complex" | "too_small" | "invalid_polygon";
34
+ /**
35
+ * Where the generated fill element belongs in the scene order, expressed
36
+ * relative to an existing element so the caller can resolve it against
37
+ * whatever (e.g. deleted-inclusive) array it inserts into.
38
+ */
39
+ export type BucketFillInsertion = {
40
+ placement: "above" | "below";
41
+ elementId: ExcalidrawElement["id"];
42
+ };
43
+ export type BucketFillGeometryResult = {
44
+ ok: true;
45
+ /**
46
+ * the closed element under the click, or null for fills resolved by
47
+ * the owner-less fallback (regions formed by open lines)
48
+ */
49
+ ownerId: ExcalidrawElement["id"] | null;
50
+ boundaryElementIds: ExcalidrawElement["id"][];
51
+ /**
52
+ * closed polygon ring in scene coordinates. When the region contains
53
+ * islands, this is a keyhole path: the hole contours are spliced in
54
+ * via zero-width bridges, so it still renders as one polygon with
55
+ * unpainted hole interiors
56
+ */
57
+ scenePoints: GlobalPoint[];
58
+ insertion: BucketFillInsertion;
59
+ } | {
60
+ ok: false;
61
+ reason: BucketFillFailureReason;
62
+ };
63
+ /**
64
+ * Whether the element visually paints an opaque background fill — i.e. can
65
+ * actually hide outlines beneath it. Element types that never render their
66
+ * `backgroundColor` (text, image, frames), see-through fill styles
67
+ * (hachure/cross-hatch), partial element opacity, and colors with an alpha
68
+ * channel below 1 (`#RRGGBBAA`, `rgba(…)`) all don't count — anything under
69
+ * them shows through.
70
+ *
71
+ * Shared with the app layer's z-order pass so "covers" means the same thing
72
+ * in boundary clipping and in fill insertion.
73
+ */
74
+ export declare const rendersOpaqueFill: (element: ExcalidrawElement) => boolean;
75
+ /**
76
+ * Whether the element renders as pure paint the bucket tool could have
77
+ * produced: a closed, visible line polygon with a background and no visible
78
+ * stroke. Recognition is by SHAPE, not by a metadata marker — any marker
79
+ * would go stale the moment the user restyles a fill, and a hand-drawn
80
+ * strokeless background polygon is indistinguishable from a generated fill
81
+ * anyway. Such paint never becomes an owner and is what the app layer
82
+ * restyles in place on re-click (see `isRestylableFill`).
83
+ */
84
+ export declare const isBucketFillCompatible: (element: ExcalidrawElement) => element is ExcalidrawLineElement;
85
+ export declare const computeBucketFillPolygon: (args: {
86
+ point: GlobalPoint;
87
+ elements: readonly NonDeletedExcalidrawElement[];
88
+ elementsMap: ElementsMap;
89
+ options?: Partial<BucketFillOptions>;
90
+ }) => BucketFillGeometryResult;
91
+ /**
92
+ * Whether the element the click landed on is a fill the bucket tool should
93
+ * restyle in place (instead of stacking an identical fill on top), given
94
+ * the computed region.
95
+ *
96
+ * Fill-compatibility is decided by shape (`isBucketFillCompatible`): a fill
97
+ * the user gave a stroke to has been repurposed into an outline and
98
+ * participates as a boundary instead of being restyled.
99
+ *
100
+ * One guard on top: the computed region's net area and bounds must match
101
+ * the element's. Without it, a click inside a shape drawn ON TOP of a
102
+ * filled region would recolor the underlying fill instead of filling that
103
+ * shape; a click on a since-subdivided part of an old fill likewise
104
+ * creates a new (smaller) fill rather than restyling the old one.
105
+ */
106
+ export declare const isRestylableFill: (args: {
107
+ hitElement: ExcalidrawElement;
108
+ scenePoints: readonly GlobalPoint[];
109
+ elementsMap: ElementsMap;
110
+ }) => boolean;
@@ -1,6 +1,6 @@
1
1
  import type { GlobalPoint, LineSegment } from "@excalidraw/math";
2
- import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
3
- import type { ElementsMap, ExcalidrawElement } from "./types";
2
+ import type { AppState, FrameNameBounds } from "@excalidraw/excalidraw/types";
3
+ import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered } from "./types";
4
4
  export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
5
5
  export type HitTestArgs = {
6
6
  point: GlobalPoint;
@@ -8,11 +8,31 @@ export type HitTestArgs = {
8
8
  threshold: number;
9
9
  elementsMap: ElementsMap;
10
10
  frameNameBound?: FrameNameBounds | null;
11
+ overrideShouldTestInside?: boolean;
11
12
  };
12
- export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
13
+ export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, overrideShouldTestInside, }: HitTestArgs) => boolean;
13
14
  export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
14
15
  export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
15
16
  export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
17
+ /**
18
+ * Whether an arrow endpoint at the point could bind to the element: inside it,
19
+ * or within binding distance of its outline. Unlike `getBindingCandidates`,
20
+ * it ignores frame clipping, as frames may not be sized yet (e.g. while
21
+ * converting skeletons, where frames are sized around their children last)
22
+ */
23
+ export declare const isPointInBindingArea: (point: GlobalPoint, element: NonDeleted<ExcalidrawBindableElement>, elementsMap: ElementsMap, zoom: AppState["zoom"]) => boolean;
24
+ /**
25
+ * Whether the element hides what is behind it from binding — an arrow's or a
26
+ * text label's. Images count as opaque, and frames once they support a
27
+ * background.
28
+ */
29
+ export declare const isOpaqueForBinding: (element: ExcalidrawElement) => boolean;
30
+ /**
31
+ * All elements an arrow endpoint at the point could bind to. Always includes
32
+ * the result of `getHoveredElementForBinding` for the same arguments.
33
+ */
34
+ export declare const getAllHoveredElementAtPoint: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => NonDeleted<ExcalidrawBindableElement>[];
35
+ export declare const getHoveredElementForBinding: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => NonDeleted<ExcalidrawBindableElement> | null;
16
36
  /**
17
37
  * Intersect a line with an element for binding test
18
38
  *
@@ -30,3 +50,4 @@ export declare const intersectElementWithLineSegment: (element: ExcalidrawElemen
30
50
  * @returns
31
51
  */
32
52
  export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
53
+ export declare const isBindableElementInsideOtherBindable: (innerElement: ExcalidrawBindableElement, outerElement: ExcalidrawBindableElement, elementsMap: ElementsMap) => boolean;
@@ -1,8 +1,11 @@
1
1
  import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
- export declare const hasBackground: (type: ElementOrToolType) => boolean;
3
- export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
4
- export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
5
- export declare const hasStrokeStyle: (type: ElementOrToolType) => boolean;
6
- export declare const canChangeRoundness: (type: ElementOrToolType) => boolean;
7
- export declare const toolIsArrow: (type: ElementOrToolType) => boolean;
8
- export declare const canHaveArrowheads: (type: ElementOrToolType) => boolean;
2
+ export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape" | "bucketfill";
3
+ export declare const hasFillStyle: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape" | "bucketfill";
4
+ export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "embeddable" | "freedraw" | "autoshape";
5
+ export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
6
+ export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "autoshape";
7
+ export declare const hasRoughness: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "embeddable" | "iframe" | "autoshape";
8
+ export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
9
+ export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "stickynote" | "diamond" | "embeddable" | "iframe" | "image";
10
+ export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
11
+ export declare const canHaveArrowheads: (type: ElementOrToolType) => type is "arrow";
@@ -0,0 +1,23 @@
1
+ import type { App, AppState } from "@excalidraw/excalidraw/types";
2
+ import type { LocalPoint, GlobalPoint } from "@excalidraw/math";
3
+ import type { Bounds } from "@excalidraw/common";
4
+ import type { ExcalidrawArrowElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, ExcalidrawRectangleElement, ElementsMap, NonDeleted, ExcalidrawLineElement } from "@excalidraw/element/types";
5
+ declare global {
6
+ interface Window {
7
+ LAST_POINTS?: readonly GlobalPoint[];
8
+ }
9
+ }
10
+ type NonDeletedRecognizedShapeElement = NonDeleted<ExcalidrawRectangleElement | ExcalidrawEllipseElement | ExcalidrawDiamondElement | ExcalidrawArrowElement | ExcalidrawLineElement | ExcalidrawFreeDrawElement>;
11
+ type Shape = NonDeletedRecognizedShapeElement["type"];
12
+ interface ShapeRecognitionResult<P extends LocalPoint | GlobalPoint> {
13
+ type: Shape;
14
+ points: readonly P[];
15
+ boundingBox: Bounds;
16
+ }
17
+ export declare const recognizeShape: <P extends LocalPoint | GlobalPoint>(points: P[], previousElement: ExcalidrawElement | null, zoom?: number) => ShapeRecognitionResult<P>;
18
+ export declare const convertToShape: (points: GlobalPoint[], appState: AppState, elementsMap: ElementsMap, previousElement: ExcalidrawElement | null, frames?: readonly ExcalidrawFrameLikeElement[]) => NonDeletedRecognizedShapeElement | undefined;
19
+ export declare const convertToShapeHandlePointerMoveFromPointerDown: (app: App, pointerCoords: {
20
+ x: number;
21
+ y: number;
22
+ }) => boolean;
23
+ export {};
@@ -1,13 +1,45 @@
1
- import type { TransformHandleType } from "./transformHandles";
2
- import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
1
+ import type { TransformHandleDirection } from "./transformHandles";
2
+ import type { ElementsMap, ExcalidrawImageElement } from "./types";
3
3
  export declare const MINIMAL_CROP_SIZE = 10;
4
- export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
4
+ /**
5
+ * Crops the image (as it was at the drag's start) as resizing it would
6
+ * resize it, as far as the image reaches.
7
+ */
8
+ export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleDirection, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, { shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
9
+ shouldMaintainAspectRatio?: boolean;
10
+ shouldResizeFromCenter?: boolean;
11
+ }) => {
5
12
  x: number;
6
13
  y: number;
7
14
  width: number;
8
15
  height: number;
9
- crop: ImageCrop | null;
16
+ crop: {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ naturalWidth: number;
22
+ naturalHeight: number;
23
+ } | null;
10
24
  };
25
+ /**
26
+ * Uncrops the image on the handle's side (a corner's two); mirrored, on the
27
+ * opposite side(s) too.
28
+ */
29
+ export declare const uncropElementSides: (element: ExcalidrawImageElement, elementsMap: ElementsMap, handle: TransformHandleDirection, mirrored?: boolean) => {
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ crop: {
35
+ x: number;
36
+ y: number;
37
+ width: number;
38
+ height: number;
39
+ naturalWidth: number;
40
+ naturalHeight: number;
41
+ } | null;
42
+ } | null;
11
43
  export declare const getUncroppedImageElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap) => ExcalidrawImageElement;
12
44
  export declare const getUncroppedWidthAndHeight: (element: ExcalidrawImageElement) => {
13
45
  width: number;