@excalidraw/math 0.18.0-414182f → 0.18.0-43a92e6

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 (371) 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 +92 -31
  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 +5 -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 +52 -77
  17. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  18. package/dist/types/element/src/Scene.d.ts +12 -8
  19. package/dist/types/element/src/align.d.ts +2 -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 +85 -51
  25. package/dist/types/element/src/bounds.d.ts +27 -18
  26. package/dist/types/element/src/bucketFill.d.ts +110 -0
  27. package/dist/types/element/src/collision.d.ts +17 -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 +23 -1
  32. package/dist/types/element/src/distribute.d.ts +3 -2
  33. package/dist/types/element/src/dragElements.d.ts +30 -3
  34. package/dist/types/element/src/duplicate.d.ts +67 -6
  35. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  36. package/dist/types/element/src/embeddable.d.ts +2 -2
  37. package/dist/types/element/src/flowchart.d.ts +11 -7
  38. package/dist/types/element/src/fractionalIndex.d.ts +4 -4
  39. package/dist/types/element/src/frame.d.ts +16 -11
  40. package/dist/types/element/src/groups.d.ts +10 -15
  41. package/dist/types/element/src/heading.d.ts +2 -1
  42. package/dist/types/element/src/image.d.ts +1 -11
  43. package/dist/types/element/src/index.d.ts +10 -4
  44. package/dist/types/element/src/linearElementEditor.d.ts +48 -30
  45. package/dist/types/element/src/listMarker.d.ts +34 -0
  46. package/dist/types/element/src/mutateElement.d.ts +6 -2
  47. package/dist/types/element/src/newElement.d.ts +59 -9
  48. package/dist/types/element/src/renderElement.d.ts +23 -12
  49. package/dist/types/element/src/resizeElements.d.ts +18 -11
  50. package/dist/types/element/src/resizeTest.d.ts +6 -5
  51. package/dist/types/element/src/selection.d.ts +11 -17
  52. package/dist/types/element/src/shape.d.ts +36 -9
  53. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  54. package/dist/types/element/src/sortElements.d.ts +10 -0
  55. package/dist/types/element/src/stickyNote.d.ts +183 -0
  56. package/dist/types/element/src/textElement.d.ts +21 -10
  57. package/dist/types/element/src/textMeasurements.d.ts +1 -3
  58. package/dist/types/element/src/textWrapping.d.ts +26 -0
  59. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +27 -8
  60. package/dist/types/element/src/transformHandles.d.ts +8 -27
  61. package/dist/types/element/src/typeChecks.d.ts +30 -31
  62. package/dist/types/element/src/types.d.ts +55 -20
  63. package/dist/types/element/src/utils.d.ts +22 -6
  64. package/dist/types/element/src/zindex.d.ts +7 -1
  65. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +248 -219
  66. package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
  67. package/dist/types/excalidraw/actions/actionBoundText.d.ts +116 -272
  68. package/dist/types/excalidraw/actions/actionCanvas.d.ts +549 -1582
  69. package/dist/types/excalidraw/actions/actionClipboard.d.ts +177 -899
  70. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +73 -64
  71. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -562
  72. package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
  73. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
  74. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
  75. package/dist/types/excalidraw/actions/actionElementLink.d.ts +80 -77
  76. package/dist/types/excalidraw/actions/actionElementLock.d.ts +149 -130
  77. package/dist/types/excalidraw/actions/actionExport.d.ts +230 -1416
  78. package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
  79. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  80. package/dist/types/excalidraw/actions/actionFrame.d.ts +247 -875
  81. package/dist/types/excalidraw/actions/actionGroup.d.ts +160 -149
  82. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +220 -197
  83. package/dist/types/excalidraw/actions/actionLink.d.ts +86 -77
  84. package/dist/types/excalidraw/actions/actionMenu.d.ts +75 -438
  85. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
  86. package/dist/types/excalidraw/actions/actionProperties.d.ts +238 -2533
  87. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +80 -75
  88. package/dist/types/excalidraw/actions/actionStyles.d.ts +74 -64
  89. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
  90. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +195 -0
  91. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +88 -80
  92. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
  93. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +87 -78
  94. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +76 -74
  95. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
  96. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
  97. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +86 -77
  98. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +87 -78
  99. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  100. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +87 -78
  101. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  102. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  103. package/dist/types/excalidraw/actions/index.d.ts +7 -3
  104. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  105. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  106. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  107. package/dist/types/excalidraw/actions/types.d.ts +11 -7
  108. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  109. package/dist/types/excalidraw/appState.d.ts +59 -28
  110. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  111. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  112. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  113. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  114. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  115. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  116. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  117. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  118. package/dist/types/excalidraw/clipboard.d.ts +13 -36
  119. package/dist/types/excalidraw/components/Actions.d.ts +33 -11
  120. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  121. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  122. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  123. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  124. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  125. package/dist/types/excalidraw/components/App.d.ts +406 -154
  126. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  127. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  128. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  129. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  130. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  131. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  132. package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
  133. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  134. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  135. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  136. package/dist/types/excalidraw/components/App.viewport.d.ts +113 -0
  137. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  138. package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
  139. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  140. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  141. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  142. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
  143. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  144. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
  145. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
  146. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
  147. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  148. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
  149. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  150. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  151. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  152. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  153. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  154. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -4
  155. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  156. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  157. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  158. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  159. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  160. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  161. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
  162. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  163. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  164. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
  165. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  166. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  167. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  168. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  169. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  170. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  171. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  172. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  173. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  174. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  175. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  176. package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
  177. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  178. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  179. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  180. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
  181. package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
  182. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  183. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  184. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  185. package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
  186. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  187. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  188. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  189. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  190. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  191. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  192. package/dist/types/excalidraw/components/Popover.d.ts +2 -3
  193. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  194. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  195. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  196. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  197. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  198. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  199. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  200. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  201. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
  202. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  203. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  204. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  205. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  206. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  207. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  208. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  209. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  210. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  211. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  212. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
  213. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  214. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  215. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  216. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  217. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  218. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  219. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  220. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  221. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  222. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  223. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  224. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  225. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  226. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
  227. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  228. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  229. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  230. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  231. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  232. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  233. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  234. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  235. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  236. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  237. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  238. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
  239. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  240. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  241. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  242. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  243. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  244. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  245. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  246. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  247. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  248. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  249. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  250. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  251. package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
  252. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  253. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  254. package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
  255. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  256. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  257. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  258. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  259. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  260. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  261. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +10 -4
  262. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  263. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  264. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  265. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  266. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  267. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  268. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  269. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  270. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  271. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  272. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  273. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  274. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  275. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  276. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  277. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  278. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  279. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  280. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  281. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
  282. package/dist/types/excalidraw/components/icons.d.ts +56 -22
  283. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
  284. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  285. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  286. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  287. package/dist/types/excalidraw/data/blob.d.ts +373 -8
  288. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  289. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  290. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  291. package/dist/types/excalidraw/data/index.d.ts +8 -9
  292. package/dist/types/excalidraw/data/json.d.ts +192 -3
  293. package/dist/types/excalidraw/data/library.d.ts +25 -10
  294. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  295. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  296. package/dist/types/excalidraw/data/types.d.ts +4 -1
  297. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  298. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  299. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  300. package/dist/types/excalidraw/errors.d.ts +14 -0
  301. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  302. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  303. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
  304. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  305. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  306. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  307. package/dist/types/excalidraw/i18n.d.ts +2 -2
  308. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  309. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  310. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  311. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  312. package/dist/types/excalidraw/renderer/animation.d.ts +16 -0
  313. package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
  314. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
  315. package/dist/types/excalidraw/scene/Renderer.d.ts +491 -19
  316. package/dist/types/excalidraw/scene/export.d.ts +4 -4
  317. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  318. package/dist/types/excalidraw/scene/types.d.ts +28 -8
  319. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  320. package/dist/types/excalidraw/snapping.d.ts +12 -12
  321. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  322. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  323. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  324. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  325. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  326. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  327. package/dist/types/excalidraw/types.d.ts +672 -61
  328. package/dist/types/excalidraw/viewport.d.ts +302 -0
  329. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +19 -5
  330. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  331. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  332. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  333. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  334. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  335. package/dist/types/math/src/constants.d.ts +0 -1
  336. package/dist/types/math/src/curve.d.ts +23 -13
  337. package/dist/types/math/src/index.d.ts +1 -0
  338. package/dist/types/math/src/pca.d.ts +79 -0
  339. package/dist/types/math/src/point.d.ts +8 -2
  340. package/dist/types/math/src/polygon.d.ts +26 -2
  341. package/dist/types/math/src/range.d.ts +1 -3
  342. package/dist/types/math/src/segment.d.ts +10 -3
  343. package/dist/types/math/src/types.d.ts +25 -1
  344. package/dist/types/utils/src/export.d.ts +9 -8
  345. package/dist/types/utils/src/index.d.ts +1 -2
  346. package/dist/types/utils/src/shape.d.ts +8 -8
  347. package/package.json +2 -2
  348. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -185
  349. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  350. package/dist/types/excalidraw/charts.d.ts +0 -27
  351. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  352. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  353. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  354. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  355. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  356. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  357. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  358. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  359. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  360. package/dist/types/excalidraw/components/shapes.d.ts +0 -190
  361. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  362. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  363. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  364. package/dist/types/excalidraw/cursor.d.ts +0 -5
  365. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  366. package/dist/types/excalidraw/index.d.ts +0 -47
  367. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  368. package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
  369. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  370. package/dist/types/utils/src/bbox.d.ts +0 -9
  371. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -0,0 +1,55 @@
1
+ import { DrawShapeTrail } from "../drawShapeTrail";
2
+ import type App from "./App";
3
+ import type { PointerDownState } from "../types";
4
+ /**
5
+ * Captures the App state management for the drawShape tool (free-form
6
+ * sketch converted into a recognized excalidraw element). Pointer events
7
+ * are piped here from App.
8
+ *
9
+ * The gesture is committed by `finalize()` — recognize → (maybe upgrade
10
+ * line to arrow) → insert → bind endpoints — which is invoked from within
11
+ * `actionFinalize`, the editor's single finalization funnel. Whatever
12
+ * triggers a finalize (the gesture's own pointerup, a mid-gesture paste
13
+ * switching tools, …), the pending sketch resolves there exactly once.
14
+ */
15
+ export declare class AppDrawShape {
16
+ private app;
17
+ trail: DrawShapeTrail;
18
+ /** a pointerdown started a sketch that `finalize()` hasn't resolved yet */
19
+ private gestureInProgress;
20
+ constructor(app: App);
21
+ stop: () => void;
22
+ hasPendingGesture: () => boolean;
23
+ handlePointerDown: (pointerDownState: PointerDownState) => void;
24
+ /** returns true when the pointermove was consumed by the shape preview */
25
+ handlePointerMove: (pointerCoords: {
26
+ x: number;
27
+ y: number;
28
+ }) => boolean;
29
+ /**
30
+ * Binds both endpoints of a freshly inserted drawShape arrow to the
31
+ * bindable elements they hover, if any.
32
+ *
33
+ * Endpoints bind in "orbit" mode — the arrow starts/ends at the target's
34
+ * outline — even when the stroke was started or released inside the shape
35
+ * (a sketched connector aims at the shape, not at a point inside it). The
36
+ * exception is a sketch contained in a single shape: both ends then bind
37
+ * "inside" and stay where they were drawn, like the interactive
38
+ * inside→inside flow.
39
+ */
40
+ private bindRecognizedArrow;
41
+ /**
42
+ * A sketched line that connects a bindable element with something else —
43
+ * another element or blank canvas — was meant as a connector: upgrade it
44
+ * to an arrow (called before insertion). A line touching no shape, or
45
+ * contained in a single shape (an annotation, not a connector), stays a
46
+ * line.
47
+ */
48
+ private maybeUpgradeLineToArrow;
49
+ /**
50
+ * Commits the pending sketch, if any, and clears the trail. Invoked from
51
+ * within `actionFinalize` — never call directly, execute `actionFinalize`
52
+ * instead so element insertion flows into the action's returned elements.
53
+ */
54
+ finalize: () => void;
55
+ }
@@ -0,0 +1,101 @@
1
+ import { duplicateElements } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
3
+ import type { PointerDownState } from "../types";
4
+ import type App from "./App";
5
+ type Duplication = Pick<ReturnType<typeof duplicateElements>, "duplicatedElements" | "duplicateElementsMap" | "origElementsMap" | "origIdToDuplicateId" | "duplicateIdToOrigId">;
6
+ /**
7
+ * Owns the duplication paths which involve the host (`props.onDuplicate`):
8
+ * duplicating elements into the scene (paste, library insert etc.), and
9
+ * duplicating the dragged selection (alt-drag). The duplicate action shares
10
+ * `runOnDuplicate()`.
11
+ */
12
+ export declare class AppDuplicate {
13
+ private app;
14
+ private dependencies;
15
+ constructor(app: App, dependencies: {
16
+ /** pointers currently down */
17
+ getPointerCount: () => number;
18
+ });
19
+ /**
20
+ * Hands the duplication over to the host's `props.onDuplicate` (if any),
21
+ * and reconciles what it returned with the duplicates.
22
+ *
23
+ * @returns next elements, and the duplicates that weren't vetoed
24
+ */
25
+ runOnDuplicate: (duplication: Duplication, nextElements: ExcalidrawElement[],
26
+ /** excludes the duplicated elements */
27
+ prevElements: readonly ExcalidrawElement[]) => {
28
+ elements: ExcalidrawElement[];
29
+ duplicatedElements: import("@excalidraw/element/types").NonDeletedExcalidrawElement[];
30
+ };
31
+ /**
32
+ * Runs `update` once what's pending is committed, capturing what it changes
33
+ * (if it returns `true`) as a separate undo step.
34
+ */
35
+ private afterCommit;
36
+ /**
37
+ * Advances the list markers of the duplicated texts (`1.` -> `2.`) once
38
+ * the duplication is committed, as a separate undo step, so that undo
39
+ * reverts the markers first.
40
+ */
41
+ advanceListMarkers: (duplicatedElements: readonly ExcalidrawElement[]) => void;
42
+ /**
43
+ * The text whose editing an alt-press on it ended, while the press is
44
+ * handed over to the canvas (see `handOverTextEditorPress()`).
45
+ */
46
+ handedOverTextId: ExcalidrawTextElement["id"] | null;
47
+ /**
48
+ * An alt-press on the text being edited, once it ended the editing, is
49
+ * handed over to the canvas, for the text to be alt-dragged (duplicated) as
50
+ * on the canvas — its duplicate is then edited on drop.
51
+ */
52
+ handOverTextEditorPress: (event: PointerEvent, textElementId: ExcalidrawTextElement["id"]) => void;
53
+ /**
54
+ * The pointer down a handed-over press is replayed as (see
55
+ * `handOverTextEditorPress()`) moves what was edited — the text, or its
56
+ * container — and nothing beneath the editor, which reaches past the text:
57
+ * no resize handle, nor an arrow's point, midpoint or label.
58
+ *
59
+ * @returns `false` if the pointer down isn't a handed-over press
60
+ */
61
+ hitEditedElement: (pointerDownState: PointerDownState) => boolean;
62
+ /**
63
+ * On alt-drag drop: the list markers advanced along with the drag go back,
64
+ * for the drag to be committed as is, and forth again once it is, as
65
+ * a separate undo step (before the browser gets to paint either).
66
+ *
67
+ * A duplicate is then edited (once the drop is committed): a single list
68
+ * item with text after its marker, with that text selected (`1. |foo|`),
69
+ * as it's likely to differ from the original's — or else the duplicate of
70
+ * the text the drag ended the editing of, with all of it selected.
71
+ */
72
+ commitDraggedDuplicates: ({ hit }: PointerDownState, { editText, }: {
73
+ /** `false` if the drag didn't end with a genuine pointerup */
74
+ editText: boolean;
75
+ }) => void;
76
+ private editDuplicatedText;
77
+ /**
78
+ * Duplicates elements so that they end up centered at the scene coords
79
+ * (and in the frame at that point, if any). Doesn't update the scene.
80
+ *
81
+ * @returns `null` if the host vetoed the duplication
82
+ */
83
+ duplicateAtSceneCoords: (elements: readonly ExcalidrawElement[], { x, y }: {
84
+ x: number;
85
+ y: number;
86
+ }, opts?: {
87
+ retainSeed?: boolean;
88
+ preserveFrameChildrenOrder?: boolean;
89
+ }) => {
90
+ nextElements: ExcalidrawElement[];
91
+ duplicatedElements: import("@excalidraw/element/types").NonDeletedExcalidrawElement[];
92
+ } | null;
93
+ /**
94
+ * Duplicates the selection being dragged: the originals go back to where
95
+ * the drag started, and the drag continues with the duplicates.
96
+ *
97
+ * If the host vetoes the duplication, the originals keep being dragged.
98
+ */
99
+ duplicateDraggedSelection: (pointerDownState: PointerDownState, event: PointerEvent) => void;
100
+ }
101
+ export {};
@@ -0,0 +1,21 @@
1
+ import type React from "react";
2
+ import type App from "./App";
3
+ import type { PendingExcalidrawElements } from "../types";
4
+ /**
5
+ * Captures the App state management for the flowchart functionality.
6
+ */
7
+ export declare class AppFlowchart {
8
+ private app;
9
+ private creator;
10
+ private navigator;
11
+ constructor(app: App);
12
+ get pendingNodes(): PendingExcalidrawElements | null;
13
+ get isCreatingChart(): boolean;
14
+ /** ends any in-progress flowchart creation/navigation session */
15
+ clear: () => void;
16
+ handleKeyEvent: (event: React.KeyboardEvent | KeyboardEvent) => boolean;
17
+ private resolveKeyboardEventToOperation;
18
+ private selectAndReveal;
19
+ private captureUpdate;
20
+ private static getLinkDirectionFromKey;
21
+ }
@@ -0,0 +1,38 @@
1
+ import { Emitter } from "@excalidraw/common";
2
+ export type HeldModifiers = Readonly<{
3
+ alt: boolean;
4
+ shift: boolean;
5
+ /** Ctrl, or Cmd on macOS */
6
+ ctrlOrCmd: boolean;
7
+ }>;
8
+ /**
9
+ * The modifier keys held over the editor, synced from the flags of its
10
+ * keyboard and pointer events. Kept out of appState so that pressing one
11
+ * re-renders only its subscribers (e.g. the hint).
12
+ */
13
+ export declare class AppModifiers {
14
+ private held;
15
+ /** fires with a new snapshot whenever a modifier is pressed or released */
16
+ readonly onChange: Emitter<[held: Readonly<{
17
+ alt: boolean;
18
+ shift: boolean;
19
+ /** Ctrl, or Cmd on macOS */
20
+ ctrlOrCmd: boolean;
21
+ }>]>;
22
+ get: () => HeldModifiers;
23
+ /**
24
+ * A hook re-rendering on the held modifiers: all of them, or with
25
+ * `modifier`, only on that one being pressed or released.
26
+ */
27
+ useHeld(): HeldModifiers;
28
+ useHeld(modifier: keyof HeldModifiers): boolean;
29
+ sync: (event: {
30
+ altKey: boolean;
31
+ shiftKey: boolean;
32
+ ctrlKey: boolean;
33
+ metaKey: boolean;
34
+ }) => void;
35
+ /** releases them all — e.g. on blur, as Alt+Tab never delivers the keyup */
36
+ reset: () => void;
37
+ private set;
38
+ }
@@ -0,0 +1,62 @@
1
+ import type React from "react";
2
+ import type App from "./App";
3
+ /**
4
+ * The drag-pan: a pointer drag that moves the canvas — the wheel or the
5
+ * secondary button, the main button while space is held or the hand tool
6
+ * is active, or any button in view mode. One session at a time, owning its
7
+ * window listeners and teardown; wheel input is gated on it (see
8
+ * `AppWheel`).
9
+ *
10
+ * A secondary-button session is a pan only once the pointer travels past
11
+ * the drag threshold; released before that, it is a right-click. The
12
+ * platform's `contextmenu` event opens the menu for a right-click where it
13
+ * follows the release (Windows), as it always has; where it comes with the
14
+ * press (macOS, Linux) it is swallowed — a drag cannot be told from a
15
+ * click yet — and the session opens the menu on release instead.
16
+ */
17
+ export declare class AppPan {
18
+ private app;
19
+ private dependencies;
20
+ /** space held down turns a main-button drag into a pan */
21
+ private spaceHeld;
22
+ private active;
23
+ /** the secondary-button session, while one is active */
24
+ private secondary;
25
+ /** the platform fires `contextmenu` on mouseup (Windows) or on mousedown
26
+ * (macOS, Linux); the one belonging to a secondary-button session is not a
27
+ * new click, whichever side of the session it lands on */
28
+ private suppressNextContextMenu;
29
+ /** applies the pointer move the session is holding back for its next
30
+ * frame, if any */
31
+ private pendingMoveFlush;
32
+ private teardown;
33
+ constructor(app: App, dependencies: {
34
+ /** pointers currently down (a two-finger gesture is not a pan) */
35
+ getPointerCount: () => number;
36
+ /** a scrollbar being dragged (App's own drag, not a pan session) */
37
+ isDraggingScrollBar: () => boolean;
38
+ });
39
+ isActive: () => boolean;
40
+ isSpaceHeld: () => boolean;
41
+ setSpaceHeld: (held: boolean) => void;
42
+ /**
43
+ * Whether the pointer is navigating the viewport rather than acting on the
44
+ * scene — space held to pan, a pan in progress, a scrollbar drag, or the
45
+ * hand tool. Hover and cursor then belong to the navigation.
46
+ */
47
+ isNavigating: () => boolean;
48
+ /** applies the pointer move still waiting for its frame, if any */
49
+ flushMove: () => void;
50
+ /** ends the active session, if any — pointerup may never arrive (the user
51
+ * tabs away, a new pointerdown lands first) */
52
+ end: () => void;
53
+ /**
54
+ * Whether a `contextmenu` event belongs to a secondary-button session and
55
+ * must not open the menu: it came with the press (the session decides on
56
+ * release), or it follows a release that turned out to be a drag.
57
+ */
58
+ consumesContextMenuEvent: () => boolean;
59
+ /** starts a session for the pointerdown if it qualifies; returns whether
60
+ * it did */
61
+ start: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
62
+ }
@@ -0,0 +1,265 @@
1
+ import { LinearElementEditor } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { Mutable } from "@excalidraw/common/utility-types";
4
+ import type { CaptureUpdateActionType } from "@excalidraw/element";
5
+ import type { AppClassProperties, AppState, InteractiveCanvasAppState } from "../types";
6
+ import type App from "./App";
7
+ export declare const selectGroupsForSelectedElements: {
8
+ (appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
9
+ clearCache(): void;
10
+ };
11
+ /**
12
+ * The selection of the given elements alone, with their groups (within the
13
+ * edited group): a frame wins over its children, bound text is left to its
14
+ * container, and a lone line or arrow gets its line editor.
15
+ *
16
+ * @param allElements the (non-deleted) elements the selection is in
17
+ * @param deep select the elements themselves rather than their groups,
18
+ * editing their innermost group if they share it (and no group otherwise)
19
+ * — as Ctrl+click does
20
+ */
21
+ export declare const getSelectionStateForElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState, deep?: boolean) => Mutable<Pick<Readonly<{
22
+ zoom: AppState["zoom"];
23
+ scrollX: AppState["scrollX"];
24
+ scrollY: AppState["scrollY"];
25
+ width: AppState["width"];
26
+ height: AppState["height"];
27
+ viewModeEnabled: AppState["viewModeEnabled"];
28
+ openDialog: AppState["openDialog"];
29
+ editingGroupId: AppState["editingGroupId"];
30
+ selectedElementIds: AppState["selectedElementIds"];
31
+ frameToHighlight: AppState["frameToHighlight"];
32
+ offsetLeft: AppState["offsetLeft"];
33
+ offsetTop: AppState["offsetTop"];
34
+ theme: AppState["theme"];
35
+ } & {
36
+ activeTool: AppState["activeTool"];
37
+ activeEmbeddable: AppState["activeEmbeddable"];
38
+ selectionElement: AppState["selectionElement"];
39
+ selectedGroupIds: AppState["selectedGroupIds"];
40
+ selectedLinearElement: AppState["selectedLinearElement"];
41
+ multiElement: AppState["multiElement"];
42
+ newElement: AppState["newElement"];
43
+ isBindingEnabled: AppState["isBindingEnabled"];
44
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
45
+ gridModeEnabled: AppState["gridModeEnabled"];
46
+ suggestedBinding: AppState["suggestedBinding"];
47
+ textToolHover: AppState["textToolHover"];
48
+ isRotating: AppState["isRotating"];
49
+ elementsToHighlight: AppState["elementsToHighlight"];
50
+ collaborators: AppState["collaborators"];
51
+ snapLines: AppState["snapLines"];
52
+ zenModeEnabled: AppState["zenModeEnabled"];
53
+ editingTextElement: AppState["editingTextElement"];
54
+ isCropping: AppState["isCropping"];
55
+ croppingElementId: AppState["croppingElementId"];
56
+ searchMatches: AppState["searchMatches"];
57
+ activeLockedId: AppState["activeLockedId"];
58
+ hoveredElementIds: AppState["hoveredElementIds"];
59
+ frameRendering: AppState["frameRendering"];
60
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
61
+ exportScale: AppState["exportScale"];
62
+ currentItemArrowType: AppState["currentItemArrowType"];
63
+ }>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
64
+ selectedLinearElement: LinearElementEditor | null;
65
+ };
66
+ /**
67
+ * The selection with the given elements added, with their groups (within the
68
+ * edited group) — and the line editor of a lone selected line or arrow.
69
+ *
70
+ * A frame and its children aren't selected at the same time: an added frame
71
+ * deselects its children, an added child of a selected (or added) frame is
72
+ * left out, and adding elements grouped with frames deselects those frames'
73
+ * children (and leaves the added ones out). In the element link selector, the
74
+ * added elements replace the selection (unless one's group is selected).
75
+ *
76
+ * @param allElements the (non-deleted) elements the selection is in
77
+ */
78
+ export declare const getSelectionStateAddingElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => Mutable<Pick<Readonly<{
79
+ zoom: AppState["zoom"];
80
+ scrollX: AppState["scrollX"];
81
+ scrollY: AppState["scrollY"];
82
+ width: AppState["width"];
83
+ height: AppState["height"];
84
+ viewModeEnabled: AppState["viewModeEnabled"];
85
+ openDialog: AppState["openDialog"];
86
+ editingGroupId: AppState["editingGroupId"];
87
+ selectedElementIds: AppState["selectedElementIds"];
88
+ frameToHighlight: AppState["frameToHighlight"];
89
+ offsetLeft: AppState["offsetLeft"];
90
+ offsetTop: AppState["offsetTop"];
91
+ theme: AppState["theme"];
92
+ } & {
93
+ activeTool: AppState["activeTool"];
94
+ activeEmbeddable: AppState["activeEmbeddable"];
95
+ selectionElement: AppState["selectionElement"];
96
+ selectedGroupIds: AppState["selectedGroupIds"];
97
+ selectedLinearElement: AppState["selectedLinearElement"];
98
+ multiElement: AppState["multiElement"];
99
+ newElement: AppState["newElement"];
100
+ isBindingEnabled: AppState["isBindingEnabled"];
101
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
102
+ gridModeEnabled: AppState["gridModeEnabled"];
103
+ suggestedBinding: AppState["suggestedBinding"];
104
+ textToolHover: AppState["textToolHover"];
105
+ isRotating: AppState["isRotating"];
106
+ elementsToHighlight: AppState["elementsToHighlight"];
107
+ collaborators: AppState["collaborators"];
108
+ snapLines: AppState["snapLines"];
109
+ zenModeEnabled: AppState["zenModeEnabled"];
110
+ editingTextElement: AppState["editingTextElement"];
111
+ isCropping: AppState["isCropping"];
112
+ croppingElementId: AppState["croppingElementId"];
113
+ searchMatches: AppState["searchMatches"];
114
+ activeLockedId: AppState["activeLockedId"];
115
+ hoveredElementIds: AppState["hoveredElementIds"];
116
+ frameRendering: AppState["frameRendering"];
117
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
118
+ exportScale: AppState["exportScale"];
119
+ currentItemArrowType: AppState["currentItemArrowType"];
120
+ }>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
121
+ selectedLinearElement: LinearElementEditor | null;
122
+ };
123
+ /**
124
+ * The selection with the given elements removed — with the group they're
125
+ * selected via (if any) — and a lone remaining line or arrow getting its
126
+ * line editor.
127
+ *
128
+ * @param allElements the (non-deleted) elements the selection is in
129
+ */
130
+ export declare const getSelectionStateRemovingElements: (targetElements: readonly NonDeletedExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => Mutable<Pick<Readonly<{
131
+ zoom: AppState["zoom"];
132
+ scrollX: AppState["scrollX"];
133
+ scrollY: AppState["scrollY"];
134
+ width: AppState["width"];
135
+ height: AppState["height"];
136
+ viewModeEnabled: AppState["viewModeEnabled"];
137
+ openDialog: AppState["openDialog"];
138
+ editingGroupId: AppState["editingGroupId"];
139
+ selectedElementIds: AppState["selectedElementIds"];
140
+ frameToHighlight: AppState["frameToHighlight"];
141
+ offsetLeft: AppState["offsetLeft"];
142
+ offsetTop: AppState["offsetTop"];
143
+ theme: AppState["theme"];
144
+ } & {
145
+ activeTool: AppState["activeTool"];
146
+ activeEmbeddable: AppState["activeEmbeddable"];
147
+ selectionElement: AppState["selectionElement"];
148
+ selectedGroupIds: AppState["selectedGroupIds"];
149
+ selectedLinearElement: AppState["selectedLinearElement"];
150
+ multiElement: AppState["multiElement"];
151
+ newElement: AppState["newElement"];
152
+ isBindingEnabled: AppState["isBindingEnabled"];
153
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
154
+ gridModeEnabled: AppState["gridModeEnabled"];
155
+ suggestedBinding: AppState["suggestedBinding"];
156
+ textToolHover: AppState["textToolHover"];
157
+ isRotating: AppState["isRotating"];
158
+ elementsToHighlight: AppState["elementsToHighlight"];
159
+ collaborators: AppState["collaborators"];
160
+ snapLines: AppState["snapLines"];
161
+ zenModeEnabled: AppState["zenModeEnabled"];
162
+ editingTextElement: AppState["editingTextElement"];
163
+ isCropping: AppState["isCropping"];
164
+ croppingElementId: AppState["croppingElementId"];
165
+ searchMatches: AppState["searchMatches"];
166
+ activeLockedId: AppState["activeLockedId"];
167
+ hoveredElementIds: AppState["hoveredElementIds"];
168
+ frameRendering: AppState["frameRendering"];
169
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
170
+ exportScale: AppState["exportScale"];
171
+ currentItemArrowType: AppState["currentItemArrowType"];
172
+ }>, "selectedElementIds" | "editingGroupId" | "selectedGroupIds">> & {
173
+ selectedLinearElement: LinearElementEditor | null;
174
+ };
175
+ /** elements, or their ids — one or many */
176
+ export type ElementsOrIds = ExcalidrawElement | ExcalidrawElement["id"] | readonly (ExcalidrawElement | ExcalidrawElement["id"])[];
177
+ type SelectionChangeOptions = {
178
+ /**
179
+ * how the change is recorded for undo (see `updateScene()`) — by default,
180
+ * along with the next undoable change
181
+ */
182
+ captureUpdate?: CaptureUpdateActionType;
183
+ };
184
+ type AddOptions = SelectionChangeOptions & {
185
+ /**
186
+ * select locked elements too — e.g. for the context menu to offer unlocking
187
+ * them
188
+ */
189
+ includeLocked?: boolean;
190
+ };
191
+ type SelectOptions = AddOptions & {
192
+ /**
193
+ * select the elements themselves rather than their groups, editing their
194
+ * innermost group (if they share it) — as Ctrl+click does
195
+ */
196
+ deep?: boolean;
197
+ };
198
+ /**
199
+ * The selection: selecting elements, adding them to or removing them from
200
+ * the selection, and clearing it — keeping its rules: an element is selected
201
+ * with its group (but within the edited group), a frame and its children
202
+ * aren't selected at the same time, locked elements aren't selected, and a
203
+ * lone line or arrow gets its line editor (see the `getSelectionState*()`
204
+ * functions above).
205
+ *
206
+ * What hangs on the selection follows it: the link popup shows for a lone
207
+ * selected element with a link (or an embeddable), an embed stays active only
208
+ * while selected, cropping ends (unless the cropped image is selected again),
209
+ * and selecting (or adding) anything but the edited text ends text editing,
210
+ * submitting the text. The line editor ends once its line is deselected (see
211
+ * `componentDidUpdate()`).
212
+ *
213
+ * Elements are taken by id from the scene: missing and deleted ones are
214
+ * skipped.
215
+ */
216
+ export declare class AppSelection {
217
+ private app;
218
+ constructor(app: App);
219
+ /**
220
+ * Selects the elements alone (with their groups, unless `deep`).
221
+ */
222
+ select: (elementsOrIds: ElementsOrIds, opts?: SelectOptions) => void;
223
+ /**
224
+ * Adds the elements (with their groups) to the selection.
225
+ */
226
+ add: (elementsOrIds: ElementsOrIds, opts?: AddOptions) => void;
227
+ /**
228
+ * Removes the elements from the selection — with the group they're
229
+ * selected via.
230
+ */
231
+ remove: (elementsOrIds: ElementsOrIds, opts?: SelectionChangeOptions) => void;
232
+ /**
233
+ * Clears the selection, leaving the edited group and ending cropping.
234
+ *
235
+ * (Doesn't end text editing: starting it clears the selection.)
236
+ */
237
+ clear: (opts?: SelectionChangeOptions) => void;
238
+ /**
239
+ * Ends what changing the selection ends — cropping (unless
240
+ * `keepsCroppedImage`), and text editing (unless selecting the edited text,
241
+ * or its container) — and records the change for undo as asked.
242
+ *
243
+ * @param elements the elements being selected (or added) — none for a
244
+ * change that leaves text editing be
245
+ */
246
+ private beforeChange;
247
+ /**
248
+ * The next selection state with what follows it: the link popup — shown for
249
+ * a lone selected element with a link (or an embeddable), the link editor
250
+ * staying open if it's the same element, and hidden otherwise — and the
251
+ * active embed, which stays active only while selected.
252
+ */
253
+ private withFollowingState;
254
+ isASelectedElement(hitElement: ExcalidrawElement | null): boolean;
255
+ isHittingCommonBoundingBoxOfSelectedElements(point: Readonly<{
256
+ x: number;
257
+ y: number;
258
+ }>, selectedElements: readonly ExcalidrawElement[]): boolean;
259
+ /**
260
+ * The scene's (non-deleted) elements, by id, once each — but locked ones,
261
+ * unless `includeLocked`
262
+ */
263
+ private resolve;
264
+ }
265
+ export {};
@@ -0,0 +1,93 @@
1
+ import type { TransformHandleType } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, ExcalidrawImageElement, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, PointerType } from "@excalidraw/element/types";
3
+ import type React from "react";
4
+ import type { PointerDownState } from "../types";
5
+ import type App from "./App";
6
+ /**
7
+ * The selection tool's (and the lasso's) selection: what a pointer down
8
+ * selects, what a click (a pointer up without a drag) does to the selection —
9
+ * including alt-click cycling through the overlapping elements — and the
10
+ * selection's transform handles (resizing, rotating, cropping).
11
+ */
12
+ export declare class AppSelectionTool {
13
+ private app;
14
+ constructor(app: App);
15
+ clearSelectionIfNotUsingSelection: () => void;
16
+ /**
17
+ * @returns whether the pointer event has been completely handled
18
+ */
19
+ handleSelectionOnPointerDown: (event: React.PointerEvent<HTMLElement>, pointerDownState: PointerDownState) => boolean;
20
+ maybeHandleCrop: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent) => boolean;
21
+ /**
22
+ * In the crop editor, a double-click on a handle uncrops its side (a
23
+ * corner's two), and mirrored, the opposite side(s) too.
24
+ *
25
+ * @returns whether the double-click has been handled
26
+ */
27
+ maybeUncropSides: (image: NonDeleted<ExcalidrawImageElement>, sceneX: number, sceneY: number, mirrored: boolean) => boolean;
28
+ maybeHandleResize: (pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent) => boolean;
29
+ /**
30
+ * Drags the selection (or, in the crop editor, the image within its crop) —
31
+ * duplicating it on an alt-drag past the drag threshold.
32
+ *
33
+ * @returns whether the pointer event has been completely handled
34
+ */
35
+ handleSelectionDragOnPointerMove: (event: PointerEvent, pointerDownState: PointerDownState, pointerCoords: {
36
+ x: number;
37
+ y: number;
38
+ }, elementsMap: NonDeletedSceneElementsMap) => boolean;
39
+ /**
40
+ * Box-selects with the selection tool — the line editor's points, while
41
+ * editing a line.
42
+ */
43
+ handleBoxSelectionOnPointerMove: (event: PointerEvent, pointerDownState: PointerDownState) => void;
44
+ /**
45
+ * After dragging the selection: the dragged elements join the frame they're
46
+ * dropped in, or leave theirs (and the edited group, if they leave it).
47
+ */
48
+ handleSelectionDragOnPointerUp: (childEvent: PointerEvent) => void;
49
+ /**
50
+ * The selection's transform handle at the scene point, if any — with its
51
+ * element, for a lone selected element.
52
+ *
53
+ * A lone selected element has none while the line editor is open or one of
54
+ * its line points is hovered, nor does an elbow arrow, a two-point line or
55
+ * arrow, or (on mobile devices) any line or arrow. The selection has none in
56
+ * the element link selector.
57
+ */
58
+ getTransformHandleAt(selectedElements: readonly NonDeletedExcalidrawElement[], sceneX: number, sceneY: number, pointerType: PointerType): {
59
+ element?: NonDeletedExcalidrawElement;
60
+ transformHandleType: TransformHandleType;
61
+ } | null;
62
+ /**
63
+ * Updates the selection on a click (no drag): the element below the
64
+ * selected one on an alt-click, the clicked element added to or removed
65
+ * from the selection with shift, or selected, and the selection cleared
66
+ * by a click hitting only a bounding box.
67
+ *
68
+ * @returns whether the pointer event has been completely handled
69
+ */
70
+ handleSelectionOnPointerUp: (childEvent: PointerEvent, pointerDownState: PointerDownState, elementsMap: NonDeletedSceneElementsMap) => boolean;
71
+ clearSelection(hitElement: ExcalidrawElement | null): void;
72
+ /** whether an alt-click on the selection (over other elements) cycles it */
73
+ canCycleSelection: () => boolean;
74
+ /**
75
+ * The selectable unit (an element, or the group a click would select) an
76
+ * element belongs to. Inside an edited group, its elements are units of
77
+ * their own.
78
+ */
79
+ private getSelectableUnit;
80
+ /**
81
+ * The selected unit, if an alt-click can cycle away from it: exactly one
82
+ * is selected, and neither the linear nor the crop editor is open.
83
+ */
84
+ private getCyclableSelectedUnit;
85
+ /**
86
+ * The element an alt-click selects: the selectable unit below the selected
87
+ * one among the hit elements, wrapping around to the topmost — or `null`
88
+ * unless it's an alt-click, the selection can cycle, and it's under the
89
+ * pointer. Inside an edited group, it cycles through the group's elements
90
+ * only, never leaving the group.
91
+ */
92
+ private getSelectionCycleTarget;
93
+ }