@excalidraw/math 0.18.0-9ba0f5d → 0.18.0-9fbeaed

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 (307) hide show
  1. package/dist/dev/index.js +349 -160
  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/colors.d.ts +24 -2
  7. package/dist/types/common/src/constants.d.ts +72 -7
  8. package/dist/types/common/src/index.d.ts +3 -0
  9. package/dist/types/common/src/keys.d.ts +6 -0
  10. package/dist/types/common/src/points.d.ts +1 -1
  11. package/dist/types/common/src/random.d.ts +7 -0
  12. package/dist/types/common/src/utils.d.ts +16 -50
  13. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  14. package/dist/types/element/src/Scene.d.ts +9 -5
  15. package/dist/types/element/src/align.d.ts +5 -2
  16. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  17. package/dist/types/element/src/arrowheads.d.ts +3 -0
  18. package/dist/types/element/src/arrows/focus.d.ts +30 -0
  19. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  20. package/dist/types/element/src/binding.d.ts +99 -17
  21. package/dist/types/element/src/bounds.d.ts +32 -9
  22. package/dist/types/element/src/bucketFill.d.ts +110 -0
  23. package/dist/types/element/src/collision.d.ts +20 -3
  24. package/dist/types/element/src/comparisons.d.ts +8 -5
  25. package/dist/types/element/src/convertToShape.d.ts +23 -0
  26. package/dist/types/element/src/cropElement.d.ts +36 -4
  27. package/dist/types/element/src/delta.d.ts +30 -2
  28. package/dist/types/element/src/distribute.d.ts +6 -2
  29. package/dist/types/element/src/dragElements.d.ts +34 -2
  30. package/dist/types/element/src/duplicate.d.ts +64 -3
  31. package/dist/types/element/src/elbowArrow.d.ts +7 -0
  32. package/dist/types/element/src/embeddable.d.ts +3 -2
  33. package/dist/types/element/src/flowchart.d.ts +9 -11
  34. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  35. package/dist/types/element/src/frame.d.ts +30 -11
  36. package/dist/types/element/src/groups.d.ts +10 -15
  37. package/dist/types/element/src/image.d.ts +5 -2
  38. package/dist/types/element/src/index.d.ts +10 -1
  39. package/dist/types/element/src/linearElementEditor.d.ts +36 -11
  40. package/dist/types/element/src/listMarker.d.ts +39 -0
  41. package/dist/types/element/src/mutateElement.d.ts +3 -1
  42. package/dist/types/element/src/newElement.d.ts +55 -3
  43. package/dist/types/element/src/renderElement.d.ts +31 -7
  44. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  45. package/dist/types/element/src/resizeElements.d.ts +14 -4
  46. package/dist/types/element/src/selection.d.ts +11 -13
  47. package/dist/types/element/src/shape.d.ts +30 -2
  48. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  49. package/dist/types/element/src/sortElements.d.ts +10 -0
  50. package/dist/types/element/src/stickyNote.d.ts +191 -0
  51. package/dist/types/element/src/textElement.d.ts +23 -11
  52. package/dist/types/element/src/textMeasurements.d.ts +15 -11
  53. package/dist/types/element/src/textWrapping.d.ts +28 -1
  54. package/dist/types/element/src/transform.d.ts +31 -8
  55. package/dist/types/element/src/typeChecks.d.ts +29 -27
  56. package/dist/types/element/src/types.d.ts +48 -9
  57. package/dist/types/element/src/utils.d.ts +19 -6
  58. package/dist/types/element/src/zindex.d.ts +2 -2
  59. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +128 -53
  60. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  61. package/dist/types/excalidraw/actions/actionBoundText.d.ts +87 -213
  62. package/dist/types/excalidraw/actions/actionCanvas.d.ts +371 -1027
  63. package/dist/types/excalidraw/actions/actionClipboard.d.ts +86 -36
  64. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +43 -18
  65. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -513
  66. package/dist/types/excalidraw/actions/actionDeselect.d.ts +183 -0
  67. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  68. package/dist/types/excalidraw/actions/actionElementLink.d.ts +39 -18
  69. package/dist/types/excalidraw/actions/actionElementLock.d.ts +87 -37
  70. package/dist/types/excalidraw/actions/actionExport.d.ts +140 -364
  71. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  72. package/dist/types/excalidraw/actions/actionFrame.d.ts +157 -684
  73. package/dist/types/excalidraw/actions/actionGroup.d.ts +102 -52
  74. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +100 -21
  75. package/dist/types/excalidraw/actions/actionLink.d.ts +44 -19
  76. package/dist/types/excalidraw/actions/actionMenu.d.ts +39 -18
  77. package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -56
  78. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -23
  79. package/dist/types/excalidraw/actions/actionStyles.d.ts +44 -18
  80. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
  81. package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +58 -32
  82. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +47 -23
  83. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +196 -0
  84. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
  85. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +44 -19
  86. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +43 -23
  87. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  88. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
  89. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +44 -19
  90. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +45 -20
  91. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  92. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +44 -19
  93. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  94. package/dist/types/excalidraw/actions/index.d.ts +7 -2
  95. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  96. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  97. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  98. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  99. package/dist/types/excalidraw/appState.d.ts +44 -17
  100. package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
  101. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  102. package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
  103. package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
  104. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  105. package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
  106. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  107. package/dist/types/excalidraw/charts/index.d.ts +8 -0
  108. package/dist/types/excalidraw/clipboard.d.ts +6 -7
  109. package/dist/types/excalidraw/components/Actions.d.ts +26 -13
  110. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  111. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  112. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  113. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  114. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  115. package/dist/types/excalidraw/components/App.d.ts +376 -112
  116. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  117. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  118. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  119. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  120. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  121. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  122. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  123. package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
  124. package/dist/types/excalidraw/components/App.text.d.ts +197 -0
  125. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  126. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  127. package/dist/types/excalidraw/components/App.viewport.d.ts +133 -0
  128. package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
  129. package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
  130. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  131. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  132. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  133. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
  134. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  135. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  136. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  137. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  138. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  139. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  140. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  141. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
  142. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -3
  143. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  144. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  145. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  146. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  147. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  148. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  149. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  150. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  151. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  152. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  153. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  154. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  155. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  156. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  157. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  158. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  159. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  160. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  161. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  162. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  163. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  164. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  165. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  166. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  167. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  168. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  169. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  170. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  171. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  172. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  173. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  174. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  175. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  176. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  177. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  178. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  179. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  180. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  181. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  182. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  183. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  184. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
  185. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
  186. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  187. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
  188. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  189. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
  190. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  191. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +8 -2
  192. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
  193. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  194. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +3 -1
  195. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
  196. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
  197. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  198. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +18 -1
  199. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  200. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  201. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
  202. package/dist/types/excalidraw/components/Toast.d.ts +8 -4
  203. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  204. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  205. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  206. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  207. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  208. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  209. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  210. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  211. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  212. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -2
  213. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  214. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  215. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
  216. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
  217. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
  218. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  219. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
  220. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  221. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  222. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  223. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  224. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  225. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  226. package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
  227. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  228. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +15 -4
  229. package/dist/types/excalidraw/components/icons.d.ts +31 -10
  230. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +27 -3
  231. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
  232. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  233. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  234. package/dist/types/excalidraw/data/blob.d.ts +119 -70
  235. package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
  236. package/dist/types/excalidraw/data/index.d.ts +9 -10
  237. package/dist/types/excalidraw/data/json.d.ts +68 -35
  238. package/dist/types/excalidraw/data/library.d.ts +1 -1
  239. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  240. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  241. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  242. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  243. package/dist/types/excalidraw/history.d.ts +10 -4
  244. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  245. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  246. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  247. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  248. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  249. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  250. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  251. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  252. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  253. package/dist/types/excalidraw/renderer/animation.d.ts +15 -4
  254. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  255. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
  256. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  257. package/dist/types/excalidraw/scene/Renderer.d.ts +490 -21
  258. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  259. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  260. package/dist/types/excalidraw/scene/types.d.ts +30 -5
  261. package/dist/types/excalidraw/snapping.d.ts +7 -7
  262. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  263. package/dist/types/excalidraw/types.d.ts +702 -44
  264. package/dist/types/excalidraw/viewport.d.ts +303 -0
  265. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +17 -3
  266. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  267. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  268. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  269. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  270. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  271. package/dist/types/math/src/constants.d.ts +0 -1
  272. package/dist/types/math/src/curve.d.ts +23 -13
  273. package/dist/types/math/src/index.d.ts +1 -0
  274. package/dist/types/math/src/pca.d.ts +79 -0
  275. package/dist/types/math/src/point.d.ts +8 -2
  276. package/dist/types/math/src/polygon.d.ts +25 -1
  277. package/dist/types/math/src/segment.d.ts +6 -0
  278. package/dist/types/math/src/types.d.ts +25 -1
  279. package/dist/types/utils/src/index.d.ts +4 -3
  280. package/dist/types/utils/src/shape.d.ts +2 -2
  281. package/package.json +2 -2
  282. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  283. package/dist/types/excalidraw/charts.d.ts +0 -27
  284. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  285. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
  286. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  287. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  288. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  289. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  290. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
  291. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
  292. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  293. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  294. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
  295. package/dist/types/excalidraw/components/shapes.d.ts +0 -190
  296. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  297. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  298. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
  299. package/dist/types/excalidraw/cursor.d.ts +0 -5
  300. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  301. package/dist/types/excalidraw/index.d.ts +0 -46
  302. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  303. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  304. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  305. package/dist/types/utils/src/bbox.d.ts +0 -9
  306. package/dist/types/utils/src/export.d.ts +0 -35
  307. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,8 +1,9 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { LineSegment, LocalPoint } from "@excalidraw/math";
3
- import type { AppState } from "@excalidraw/excalidraw/types";
3
+ import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
4
4
  import type { Bounds } from "@excalidraw/common";
5
5
  import { type Heading } from "./heading";
6
+ import type { RenderEnvironment } from "./renderEnvironment";
6
7
  import type { Scene } from "./Scene";
7
8
  import type { ElementUpdate } from "./mutateElement";
8
9
  import type { BindMode, ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, ExcalidrawElbowArrowElement, ExcalidrawElement, FixedPoint, FixedPointBinding, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered, PointsPositionUpdates } from "./types";
@@ -24,17 +25,20 @@ export type BindingStrategy = {
24
25
  *
25
26
  * IMPORTANT: currently must be > 0 (this also applies to the computed gap)
26
27
  */
27
- export declare const BASE_BINDING_GAP = 10;
28
- export declare const BASE_BINDING_GAP_ELBOW = 5;
29
- export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
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;
30
32
  export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
31
- export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
32
- export declare const isBindingEnabled: (appState: AppState) => boolean;
33
+ export declare const isBindingEnabled: (appState: {
34
+ isBindingEnabled: AppState["isBindingEnabled"];
35
+ }) => boolean;
33
36
  export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, scenePointerX: number, scenePointerY: number, scene: Scene, appState: AppState, opts?: {
34
37
  newArrow?: boolean;
35
38
  altKey?: boolean;
36
39
  angleLocked?: boolean;
37
40
  initialBinding?: boolean;
41
+ gridSize?: NullableGridSize;
38
42
  }) => {
39
43
  start: BindingStrategy;
40
44
  end: BindingStrategy;
@@ -45,33 +49,103 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
45
49
  altKey?: boolean;
46
50
  finalize?: boolean;
47
51
  initialBinding?: boolean;
48
- zoom?: AppState["zoom"];
52
+ gridSize?: NullableGridSize;
49
53
  }) => {
50
54
  start: BindingStrategy;
51
55
  end: BindingStrategy;
52
56
  };
53
57
  export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
54
- export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint) => void;
55
- export declare const unbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
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: {
111
+ x: number;
112
+ y: number;
113
+ }, scene: Scene, opts?: {
114
+ originalElements?: ElementsMap;
115
+ /** measures the arrows' labels */
116
+ renderEnvironment?: RenderEnvironment;
117
+ }) => void;
56
118
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
57
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
119
+ /** see `getSimultaneouslyUpdatedElementIds` for how to pass it */
120
+ simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
58
121
  changedElements?: Map<string, ExcalidrawElement>;
122
+ /** measures the labels of the arrows it updates (the host's, in the editor) */
123
+ renderEnvironment?: RenderEnvironment;
59
124
  }) => void;
60
- export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, appState: AppState, options?: {
61
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
125
+ export declare const updateBindings: (latestElement: NonDeletedExcalidrawElement, scene: Scene, appState: AppState, options?: {
126
+ simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
62
127
  newSize?: {
63
128
  width: number;
64
129
  height: number;
65
130
  };
131
+ /** measures the labels of the bound arrows it updates */
132
+ renderEnvironment?: RenderEnvironment;
66
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"]>;
67
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;
68
- export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => GlobalPoint;
142
+ export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"], customIntersector?: LineSegment<GlobalPoint>, isMidpointSnappingEnabled?: boolean) => GlobalPoint;
69
143
  export declare const avoidRectangularCorner: (arrowElement: ExcalidrawArrowElement, bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
70
- export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "startBinding" | "endBinding", binding: FixedPointBinding | null | undefined, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => LocalPoint | null;
71
- export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
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) => {
72
146
  fixedPoint: FixedPoint;
73
147
  };
74
- export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
148
+ export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
75
149
  fixedPoint: FixedPoint;
76
150
  };
77
151
  export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
@@ -120,5 +194,13 @@ export declare class BindableElement {
120
194
  export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: FixedPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
121
195
  export declare const getGlobalFixedPoints: (arrow: ExcalidrawArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
122
196
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
123
- 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;
124
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;
@@ -2,7 +2,7 @@ import { type Bounds } from "@excalidraw/common";
2
2
  import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
3
3
  import type { AppState } from "@excalidraw/excalidraw/types";
4
4
  import type { Drawable, Op } from "roughjs/bin/core";
5
- import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
5
+ import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
6
6
  export type RectangleBox = {
7
7
  x: number;
8
8
  y: number;
@@ -38,24 +38,26 @@ export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBo
38
38
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
39
39
  export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
40
40
  export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: (p: GlobalPoint) => GlobalPoint) => Bounds;
41
- export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => 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;
42
46
  /** @returns number in pixels */
43
47
  export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
44
48
  /** @returns number in degrees */
45
- export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
46
- 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;
47
53
  export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
48
54
  export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
49
- export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
55
+ export declare const getDraggedElementsBounds: (elements: readonly NonDeletedExcalidrawElement[], dragOffset: {
50
56
  x: number;
51
57
  y: number;
52
58
  }) => number[];
53
59
  export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => Bounds;
54
60
  export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => Bounds;
55
- export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
56
- x: number;
57
- y: number;
58
- }) => Bounds;
59
61
  export interface BoundingBox {
60
62
  minX: number;
61
63
  minY: number;
@@ -77,5 +79,26 @@ export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
77
79
  */
78
80
  export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
79
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;
80
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[];
81
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,5 +1,5 @@
1
1
  import type { GlobalPoint, LineSegment } from "@excalidraw/math";
2
- import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
2
+ import type { AppState, FrameNameBounds } from "@excalidraw/excalidraw/types";
3
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 = {
@@ -14,8 +14,25 @@ export declare const hitElementItself: ({ point, element, threshold, elementsMap
14
14
  export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
15
15
  export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
16
16
  export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
17
- export declare const getAllHoveredElementAtPoint: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, toleranceFn?: (element: ExcalidrawBindableElement) => number) => NonDeleted<ExcalidrawBindableElement>[];
18
- export declare const getHoveredElementForBinding: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, toleranceFn?: (element: ExcalidrawBindableElement) => number) => NonDeleted<ExcalidrawBindableElement> | null;
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;
19
36
  /**
20
37
  * Intersect a line with an element for binding test
21
38
  *
@@ -1,8 +1,11 @@
1
1
  import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
- export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
3
- export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
4
- export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
5
- export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
6
- export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
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";
7
10
  export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
8
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;
@@ -2,6 +2,7 @@ import type { ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElement
2
2
  import type { DTO, ValueOf } from "@excalidraw/common/utility-types";
3
3
  import type { AppState, ObservedAppState } from "@excalidraw/excalidraw/types";
4
4
  import { StoreSnapshot } from "./store";
5
+ import type { RenderEnvironment } from "./renderEnvironment";
5
6
  /**
6
7
  * Represents the difference between two objects of the same type.
7
8
  *
@@ -146,6 +147,11 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
146
147
  type ElementPartial<TElement extends ExcalidrawElement = ExcalidrawElement> = Omit<Partial<Ordered<TElement>>, "id" | "updated" | "seed">;
147
148
  export type ApplyToOptions = {
148
149
  excludedProperties?: Set<keyof ElementPartial>;
150
+ /**
151
+ * measures the labels re-laid out after applying (bound texts, and the
152
+ * labels of bound arrows) -- the editor passes the host's
153
+ */
154
+ renderEnvironment?: RenderEnvironment;
149
155
  };
150
156
  /**
151
157
  * Elements change is a low level primitive to capture a change between two sets of elements.
@@ -192,7 +198,29 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
192
198
  private static createGetter;
193
199
  private static applyDelta;
194
200
  /**
195
- * Check for visible changes regardless of whether they were removed, added or updated.
201
+ * Whether an element looks different after the delta — and the layout that
202
+ * followed it — was applied. The input to history's "skip entries with no
203
+ * visible change" loop.
204
+ *
205
+ * Both sides are first reduced to what actually paints:
206
+ * - a missing or deleted element paints nothing;
207
+ * - an empty text element paints nothing either — unless it carries arrow
208
+ * bindings (an arrow may end at it) or sits on an arrow (an empty label
209
+ * still cuts the arrow's gap);
210
+ * so an empty label's deletion or restoration compares as nothing against
211
+ * nothing. Two painting elements are then compared property by property:
212
+ * - `version`, `versionNonce`, `updated`, `created` are metadata, and
213
+ * `index` is covered by the separate z-order check (`reorderElements`);
214
+ * - `boundElements` is compared as `type:id` references with references to
215
+ * empty labels dropped, so adding or removing an empty label's reference
216
+ * is not visible on its own, and binding repair that rebuilt equal
217
+ * objects is not either;
218
+ * - everything else counts. Nested arrays (`points`, binding fixed points)
219
+ * compare by reference, which can only over-report a change — the safe
220
+ * direction, where undo stops one entry early.
221
+ *
222
+ * `previousElements` holds only `idsToCheck` (see `applyTo`); the label
223
+ * lookups it serves are for elements whose labels are in that set.
196
224
  */
197
225
  private static checkForVisibleDifference;
198
226
  /**
@@ -214,7 +242,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
214
242
  * should be rebound (if possible) with the current element ~ bindings should be bidirectional.
215
243
  */
216
244
  private static rebindAffected;
217
- static redrawElements(nextElements: SceneElementsMap, changedElements: Map<string, OrderedExcalidrawElement>): SceneElementsMap;
245
+ static redrawElements(nextElements: SceneElementsMap, changedElements: Map<string, OrderedExcalidrawElement>, renderEnvironment?: RenderEnvironment): SceneElementsMap;
218
246
  private static redrawTextBoundingBoxes;
219
247
  private static redrawBoundArrows;
220
248
  private static reorderElements;
@@ -1,7 +1,11 @@
1
1
  import type { AppState } from "@excalidraw/excalidraw/types";
2
- import type { ElementsMap, ExcalidrawElement } from "./types";
2
+ import type { RenderEnvironment } from "./renderEnvironment";
3
+ import type { Scene } from "./Scene";
4
+ import type { ElementsMap, NonDeletedExcalidrawElement } from "./types";
3
5
  export interface Distribution {
4
6
  space: "between";
5
7
  axis: "x" | "y";
6
8
  }
7
- export declare const distributeElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, distribution: Distribution, appState: Readonly<AppState>) => ExcalidrawElement[];
9
+ export declare const distributeElements: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, distribution: Distribution, appState: Readonly<AppState>, scene: Scene,
10
+ /** measures the labels of the bound arrows the distribution moves */
11
+ renderEnvironment?: RenderEnvironment) => NonDeletedExcalidrawElement[];
@@ -1,15 +1,46 @@
1
1
  import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
2
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { RenderEnvironment } from "./renderEnvironment";
3
4
  import type { Scene } from "./Scene";
5
+ import type { ExcalidrawTextElement } from "./types";
4
6
  export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
5
7
  x: number;
6
8
  y: number;
7
9
  }, scene: Scene, snapOffset: {
8
10
  x: number;
9
11
  y: number;
10
- }, gridSize: NullableGridSize) => void;
12
+ }, gridSize: NullableGridSize,
13
+ /** measures the labels of the bound arrows the drag moves */
14
+ renderEnvironment?: RenderEnvironment) => void;
11
15
  export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
12
- export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
16
+ /**
17
+ * Sizes a text element as it is dragged out.
18
+ *
19
+ * A dragged text pins one point and grows away from it; `anchorRatio` says
20
+ * where along the box that point sits — 0 for its left edge, 1 for its right,
21
+ * 0.5 for its centre.
22
+ *
23
+ * A free text pins the point the drag started from and takes the ratio from
24
+ * the drag direction, so it can be pulled either way. A text bound to an arrow
25
+ * endpoint instead pins whatever the binding placed it against and takes the
26
+ * ratio from its alignment — which is also what keeps it from growing back
27
+ * over the arrow, since dragging that way makes no progress rather than
28
+ * flipping the box around.
29
+ */
30
+ export declare const dragNewTextElement: ({ newElement, anchorX, anchorRatio, pointerX, nextY, zoom, scene, renderEnvironment, informMutation, }: {
31
+ newElement: ExcalidrawTextElement;
32
+ anchorX: number;
33
+ /** 0 = anchored by its left edge, 1 = by its right, 0.5 = by its centre */
34
+ anchorRatio: number;
35
+ pointerX: number;
36
+ /** free text re-tops itself to the drag origin; a bound one must not move */
37
+ nextY?: number;
38
+ zoom: NormalizedZoomValue;
39
+ scene: Scene;
40
+ renderEnvironment?: RenderEnvironment;
41
+ informMutation?: boolean;
42
+ }) => void;
43
+ export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, renderEnvironment, widthAspectRatio, originOffset, informMutation, }: {
13
44
  newElement: NonDeletedExcalidrawElement;
14
45
  elementType: AppState["activeTool"]["type"];
15
46
  originX: number;
@@ -22,6 +53,7 @@ export declare const dragNewElement: ({ newElement, elementType, originX, origin
22
53
  shouldResizeFromCenter: boolean;
23
54
  zoom: NormalizedZoomValue;
24
55
  scene: Scene;
56
+ renderEnvironment?: RenderEnvironment;
25
57
  /** whether to keep given aspect ratio when `isResizeWithSidesSameLength` is
26
58
  true */
27
59
  widthAspectRatio?: number | null;