@excalidraw/common 0.18.0-3bdaafe → 0.18.0-3c916c5

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 (378) hide show
  1. package/dist/dev/index.js +1867 -345
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +3 -3
  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 +103 -35
  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 +59 -78
  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 +5 -2
  20. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  21. package/dist/types/element/src/arrowheads.d.ts +3 -0
  22. package/dist/types/element/src/arrows/focus.d.ts +30 -0
  23. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  24. package/dist/types/element/src/binding.d.ts +145 -49
  25. package/dist/types/element/src/bounds.d.ts +34 -19
  26. package/dist/types/element/src/bucketFill.d.ts +110 -0
  27. package/dist/types/element/src/collision.d.ts +24 -3
  28. package/dist/types/element/src/comparisons.d.ts +10 -7
  29. package/dist/types/element/src/convertToShape.d.ts +23 -0
  30. package/dist/types/element/src/cropElement.d.ts +36 -4
  31. package/dist/types/element/src/delta.d.ts +30 -2
  32. package/dist/types/element/src/distribute.d.ts +6 -2
  33. package/dist/types/element/src/dragElements.d.ts +37 -5
  34. package/dist/types/element/src/duplicate.d.ts +67 -6
  35. package/dist/types/element/src/elbowArrow.d.ts +7 -0
  36. package/dist/types/element/src/embeddable.d.ts +3 -2
  37. package/dist/types/element/src/flowchart.d.ts +9 -11
  38. package/dist/types/element/src/fractionalIndex.d.ts +4 -4
  39. package/dist/types/element/src/frame.d.ts +35 -12
  40. package/dist/types/element/src/groups.d.ts +10 -15
  41. package/dist/types/element/src/heading.d.ts +2 -1
  42. package/dist/types/element/src/image.d.ts +6 -13
  43. package/dist/types/element/src/index.d.ts +11 -4
  44. package/dist/types/element/src/linearElementEditor.d.ts +51 -30
  45. package/dist/types/element/src/listMarker.d.ts +39 -0
  46. package/dist/types/element/src/mutateElement.d.ts +6 -2
  47. package/dist/types/element/src/newElement.d.ts +61 -9
  48. package/dist/types/element/src/renderElement.d.ts +33 -12
  49. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  50. package/dist/types/element/src/resizeElements.d.ts +24 -14
  51. package/dist/types/element/src/resizeTest.d.ts +6 -5
  52. package/dist/types/element/src/selection.d.ts +11 -17
  53. package/dist/types/element/src/shape.d.ts +38 -9
  54. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  55. package/dist/types/element/src/sortElements.d.ts +10 -0
  56. package/dist/types/element/src/stickyNote.d.ts +191 -0
  57. package/dist/types/element/src/textElement.d.ts +23 -11
  58. package/dist/types/element/src/textMeasurements.d.ts +16 -14
  59. package/dist/types/element/src/textWrapping.d.ts +28 -1
  60. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +32 -9
  61. package/dist/types/element/src/transformHandles.d.ts +8 -27
  62. package/dist/types/element/src/typeChecks.d.ts +30 -31
  63. package/dist/types/element/src/types.d.ts +55 -20
  64. package/dist/types/element/src/utils.d.ts +22 -6
  65. package/dist/types/element/src/zindex.d.ts +7 -1
  66. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +248 -219
  67. package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
  68. package/dist/types/excalidraw/actions/actionBoundText.d.ts +116 -272
  69. package/dist/types/excalidraw/actions/actionCanvas.d.ts +578 -1611
  70. package/dist/types/excalidraw/actions/actionClipboard.d.ts +177 -899
  71. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +73 -64
  72. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -562
  73. package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
  74. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
  75. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
  76. package/dist/types/excalidraw/actions/actionElementLink.d.ts +80 -77
  77. package/dist/types/excalidraw/actions/actionElementLock.d.ts +149 -130
  78. package/dist/types/excalidraw/actions/actionExport.d.ts +229 -1415
  79. package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
  80. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  81. package/dist/types/excalidraw/actions/actionFrame.d.ts +247 -875
  82. package/dist/types/excalidraw/actions/actionGroup.d.ts +160 -149
  83. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +261 -238
  84. package/dist/types/excalidraw/actions/actionLink.d.ts +86 -77
  85. package/dist/types/excalidraw/actions/actionMenu.d.ts +75 -438
  86. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
  87. package/dist/types/excalidraw/actions/actionProperties.d.ts +238 -2533
  88. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +80 -75
  89. package/dist/types/excalidraw/actions/actionStyles.d.ts +74 -64
  90. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
  91. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +195 -0
  92. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +88 -80
  93. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
  94. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +87 -78
  95. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +76 -74
  96. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
  97. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
  98. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +86 -77
  99. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +87 -78
  100. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  101. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +87 -78
  102. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  103. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  104. package/dist/types/excalidraw/actions/index.d.ts +7 -3
  105. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  106. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  107. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  108. package/dist/types/excalidraw/actions/types.d.ts +11 -7
  109. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  110. package/dist/types/excalidraw/appState.d.ts +66 -35
  111. package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
  112. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  113. package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
  114. package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
  115. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  116. package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
  117. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  118. package/dist/types/excalidraw/charts/index.d.ts +8 -0
  119. package/dist/types/excalidraw/clipboard.d.ts +58 -21
  120. package/dist/types/excalidraw/components/Actions.d.ts +33 -11
  121. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  122. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  123. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  124. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  125. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  126. package/dist/types/excalidraw/components/App.d.ts +415 -154
  127. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  128. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  129. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  130. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  131. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  132. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  133. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  134. package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
  135. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  136. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  137. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  138. package/dist/types/excalidraw/components/App.viewport.d.ts +123 -0
  139. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  140. package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
  141. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  142. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  143. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  144. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
  145. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  146. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
  147. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
  148. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
  149. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  150. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
  151. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  152. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  153. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  154. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  155. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  156. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +6 -5
  157. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  158. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  159. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  160. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  161. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  162. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  163. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
  164. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  165. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  166. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
  167. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  168. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  169. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  170. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  171. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  172. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  173. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  174. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  175. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  176. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  177. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  178. package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
  179. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  180. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  181. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  182. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
  183. package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
  184. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  185. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  186. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  187. package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
  188. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  189. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  190. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  191. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  192. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  193. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  194. package/dist/types/excalidraw/components/Popover.d.ts +2 -3
  195. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  196. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  197. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  198. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  199. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  200. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  201. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  202. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  203. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
  204. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  205. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  206. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  207. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  208. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  209. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  210. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  211. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  212. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  213. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  214. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
  215. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  216. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  217. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  218. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  219. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  220. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  221. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  222. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  223. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  224. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  225. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  226. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  227. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  228. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +4 -2
  229. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  230. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  231. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  232. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +9 -3
  233. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  234. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  235. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  236. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  237. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +12 -0
  238. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  239. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +10 -0
  240. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +19 -16
  241. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  242. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  243. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +8 -0
  244. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  245. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +108 -0
  246. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  247. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  248. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  249. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
  250. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  251. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  252. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  253. package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
  254. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  255. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  256. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  257. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  258. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  259. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  260. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  261. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  262. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  263. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +9 -4
  264. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  265. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  266. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  267. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  268. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  269. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  270. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  271. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  272. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  273. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  274. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  275. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  276. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  277. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  278. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  279. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  280. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  281. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  282. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  283. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  284. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +16 -5
  285. package/dist/types/excalidraw/components/icons.d.ts +56 -22
  286. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
  287. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  288. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  289. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  290. package/dist/types/excalidraw/data/blob.d.ts +373 -15
  291. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  292. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  293. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  294. package/dist/types/excalidraw/data/index.d.ts +11 -12
  295. package/dist/types/excalidraw/data/json.d.ts +192 -3
  296. package/dist/types/excalidraw/data/library.d.ts +25 -10
  297. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  298. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  299. package/dist/types/excalidraw/data/types.d.ts +4 -1
  300. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  301. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  302. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  303. package/dist/types/excalidraw/errors.d.ts +14 -0
  304. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  305. package/dist/types/excalidraw/history.d.ts +10 -4
  306. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  307. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
  308. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  309. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  310. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  311. package/dist/types/excalidraw/i18n.d.ts +2 -2
  312. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  313. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  314. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  315. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  316. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  317. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  318. package/dist/types/excalidraw/renderer/animation.d.ts +23 -0
  319. package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
  320. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
  321. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  322. package/dist/types/excalidraw/scene/Renderer.d.ts +492 -20
  323. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  324. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  325. package/dist/types/excalidraw/scene/types.d.ts +51 -9
  326. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  327. package/dist/types/excalidraw/snapping.d.ts +12 -12
  328. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  329. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  330. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  331. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  332. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  333. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  334. package/dist/types/excalidraw/types.d.ts +697 -61
  335. package/dist/types/excalidraw/viewport.d.ts +302 -0
  336. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +19 -5
  337. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  338. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  339. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  340. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  341. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  342. package/dist/types/math/src/constants.d.ts +0 -1
  343. package/dist/types/math/src/curve.d.ts +23 -13
  344. package/dist/types/math/src/index.d.ts +1 -0
  345. package/dist/types/math/src/pca.d.ts +79 -0
  346. package/dist/types/math/src/point.d.ts +8 -2
  347. package/dist/types/math/src/polygon.d.ts +26 -2
  348. package/dist/types/math/src/range.d.ts +1 -3
  349. package/dist/types/math/src/segment.d.ts +10 -3
  350. package/dist/types/math/src/types.d.ts +25 -1
  351. package/dist/types/utils/src/index.d.ts +4 -3
  352. package/dist/types/utils/src/shape.d.ts +8 -8
  353. package/package.json +7 -1
  354. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -185
  355. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  356. package/dist/types/excalidraw/charts.d.ts +0 -27
  357. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  358. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  359. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  360. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  361. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  362. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  363. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  364. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  365. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  366. package/dist/types/excalidraw/components/shapes.d.ts +0 -190
  367. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  368. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  369. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  370. package/dist/types/excalidraw/cursor.d.ts +0 -5
  371. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  372. package/dist/types/excalidraw/index.d.ts +0 -47
  373. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  374. package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
  375. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  376. package/dist/types/utils/src/bbox.d.ts +0 -9
  377. package/dist/types/utils/src/export.d.ts +0 -35
  378. 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,102 @@
1
+ import type { RenderEnvironment } from "@excalidraw/element";
2
+ import { type EyeDropperProperties } from "./EyeDropper";
3
+ import { type HyperlinkTooltipOwner } from "./hyperlink/Hyperlink";
4
+ import type { AppProps } from "../types";
5
+ import type App from "./App";
6
+ /**
7
+ * Owns everything that ties this editor to the document/window it renders
8
+ * into (cross-document runtime ownership): the render environment the
9
+ * canvases, images and paths are minted from, and the state that has to be
10
+ * re-primed whenever that environment is swapped.
11
+ */
12
+ export declare class AppHost {
13
+ private app;
14
+ constructor(app: App);
15
+ /**
16
+ * Identity token for the hyperlink tooltip, which is a module-level
17
+ * singleton shared by every editor in the process — the owner tells it
18
+ * which editor the currently shown tooltip belongs to, so one editor never
19
+ * hides (or leaks a timer into) another's tooltip.
20
+ */
21
+ readonly hyperlinkTooltipOwner: HyperlinkTooltipOwner;
22
+ /**
23
+ * The process-wide interaction slots this editor currently owns: the
24
+ * pointerup handler of the interaction in flight, and the eye dropper (one
25
+ * atom in the editor-wide store). Both hold closures over this editor, so a
26
+ * teardown that leaves one set retains the editor -- and with it its owner
27
+ * window and document, e.g. a closed popout.
28
+ *
29
+ * @see releaseOwnedInteractionState
30
+ */
31
+ private ownedPointerUp;
32
+ private ownedEyeDropper;
33
+ /** Takes over the pointerup slot (or clears it, on `null`). */
34
+ setPointerUp(handler: (() => void) | null): void;
35
+ /**
36
+ * Runs the pending pointerup, whoever owns it -- pointerup does not always
37
+ * fire (the user tabs away), so interactions are settled manually.
38
+ */
39
+ runPendingPointerUp(): void;
40
+ /** Opens the eye dropper (or closes it, on `null`), taking ownership. */
41
+ setActiveEyeDropper(eyeDropper: EyeDropperProperties | null): void;
42
+ /**
43
+ * Drops the ownership token without touching the atom -- for callers that
44
+ * have just closed the eye dropper themselves.
45
+ */
46
+ releaseEyeDropperOwnership(): void;
47
+ /**
48
+ * Releases the process-wide slots this editor owns, so nothing outside it
49
+ * keeps it alive once it is torn down. Ownership-checked: a sibling
50
+ * editor's in-flight interaction must survive our teardown.
51
+ */
52
+ private releaseOwnedInteractionState;
53
+ /**
54
+ * Render environment scoped to this editor's owner window, so that the
55
+ * canvases, images and paths created during rendering live in the owner
56
+ * document. Memoized keyed on the resolved document because render caches
57
+ * are keyed by environment identity: the identity must not survive a
58
+ * document switch, or caches would mix canvases and images from two realms
59
+ * under one bucket.
60
+ */
61
+ private _renderEnvironment;
62
+ private _renderEnvironmentDocument;
63
+ get renderEnvironment(): RenderEnvironment;
64
+ /**
65
+ * Re-primes whatever the render environment owns. Called on mount and on
66
+ * every update, so an environment swap is picked up wherever it happens.
67
+ */
68
+ sync(prevProps?: AppProps): void;
69
+ /**
70
+ * Releases what this editor owns outside itself, so we don't retain the
71
+ * (soon detached) document/window, or leave a pending tooltip timer around.
72
+ */
73
+ destroy(): void;
74
+ private _destroyed;
75
+ /**
76
+ * Link icons decode asynchronously and the static scene skips an icon that
77
+ * is not decoded yet, so start the decode on mount rather than on the
78
+ * first render that happens to have a link, so the decode is settled long
79
+ * before there is a link element to draw an icon for.
80
+ *
81
+ * Re-run on an environment swap: the images are keyed by env identity, so
82
+ * a new environment starts with none.
83
+ *
84
+ * The decode landing only flips a status, which invalidates nothing, so the
85
+ * scene is nudged once when an icon becomes drawable -- otherwise a scene
86
+ * that paints before the decode settles and is then left alone (an initial
87
+ * scene with links, never scrolled or edited) keeps its icons missing until
88
+ * something unrelated repaints. Same shape as a font or an image file
89
+ * landing: repaint only when there is something new to draw.
90
+ */
91
+ private _linkImgDecodingEnvironment;
92
+ private ensureLinkImgDecoding;
93
+ /**
94
+ * Every render cache is keyed by environment identity, so a host passing an
95
+ * inline `renderEnvironment` literal re-mints the identity on each render
96
+ * and re-rasterizes everything, with no visible symptom other than being
97
+ * slow. Detected by the factories' source being unchanged across the swap:
98
+ * a genuine environment switch (e.g. a document change) reads differently.
99
+ */
100
+ private _warnedUnstableRenderEnvironment;
101
+ private warnOnUnstableRenderEnvironment;
102
+ }
@@ -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" | "selectedGroupIds" | "editingGroupId">> & {
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" | "selectedGroupIds" | "editingGroupId">> & {
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" | "selectedGroupIds" | "editingGroupId">> & {
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 {};