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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/dev/index.js +349 -160
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/appEventBus.d.ts +27 -0
  6. package/dist/types/common/src/colors.d.ts +24 -2
  7. package/dist/types/common/src/constants.d.ts +72 -7
  8. package/dist/types/common/src/index.d.ts +3 -0
  9. package/dist/types/common/src/keys.d.ts +6 -0
  10. package/dist/types/common/src/points.d.ts +1 -1
  11. package/dist/types/common/src/random.d.ts +7 -0
  12. package/dist/types/common/src/utils.d.ts +16 -50
  13. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  14. package/dist/types/element/src/Scene.d.ts +9 -5
  15. package/dist/types/element/src/align.d.ts +5 -2
  16. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  17. package/dist/types/element/src/arrowheads.d.ts +3 -0
  18. package/dist/types/element/src/arrows/focus.d.ts +30 -0
  19. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  20. package/dist/types/element/src/binding.d.ts +99 -17
  21. package/dist/types/element/src/bounds.d.ts +32 -9
  22. package/dist/types/element/src/bucketFill.d.ts +110 -0
  23. package/dist/types/element/src/collision.d.ts +20 -3
  24. package/dist/types/element/src/comparisons.d.ts +8 -5
  25. package/dist/types/element/src/convertToShape.d.ts +23 -0
  26. package/dist/types/element/src/cropElement.d.ts +36 -4
  27. package/dist/types/element/src/delta.d.ts +30 -2
  28. package/dist/types/element/src/distribute.d.ts +6 -2
  29. package/dist/types/element/src/dragElements.d.ts +34 -2
  30. package/dist/types/element/src/duplicate.d.ts +64 -3
  31. package/dist/types/element/src/elbowArrow.d.ts +7 -0
  32. package/dist/types/element/src/embeddable.d.ts +3 -2
  33. package/dist/types/element/src/flowchart.d.ts +9 -11
  34. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  35. package/dist/types/element/src/frame.d.ts +30 -11
  36. package/dist/types/element/src/groups.d.ts +10 -15
  37. package/dist/types/element/src/image.d.ts +5 -2
  38. package/dist/types/element/src/index.d.ts +10 -1
  39. package/dist/types/element/src/linearElementEditor.d.ts +36 -11
  40. package/dist/types/element/src/listMarker.d.ts +39 -0
  41. package/dist/types/element/src/mutateElement.d.ts +3 -1
  42. package/dist/types/element/src/newElement.d.ts +55 -3
  43. package/dist/types/element/src/renderElement.d.ts +31 -7
  44. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  45. package/dist/types/element/src/resizeElements.d.ts +14 -4
  46. package/dist/types/element/src/selection.d.ts +11 -13
  47. package/dist/types/element/src/shape.d.ts +30 -2
  48. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  49. package/dist/types/element/src/sortElements.d.ts +10 -0
  50. package/dist/types/element/src/stickyNote.d.ts +191 -0
  51. package/dist/types/element/src/textElement.d.ts +23 -11
  52. package/dist/types/element/src/textMeasurements.d.ts +15 -11
  53. package/dist/types/element/src/textWrapping.d.ts +28 -1
  54. package/dist/types/element/src/transform.d.ts +31 -8
  55. package/dist/types/element/src/typeChecks.d.ts +29 -27
  56. package/dist/types/element/src/types.d.ts +48 -9
  57. package/dist/types/element/src/utils.d.ts +19 -6
  58. package/dist/types/element/src/zindex.d.ts +2 -2
  59. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +128 -53
  60. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  61. package/dist/types/excalidraw/actions/actionBoundText.d.ts +87 -213
  62. package/dist/types/excalidraw/actions/actionCanvas.d.ts +371 -1027
  63. package/dist/types/excalidraw/actions/actionClipboard.d.ts +86 -36
  64. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +43 -18
  65. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -513
  66. package/dist/types/excalidraw/actions/actionDeselect.d.ts +183 -0
  67. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  68. package/dist/types/excalidraw/actions/actionElementLink.d.ts +39 -18
  69. package/dist/types/excalidraw/actions/actionElementLock.d.ts +87 -37
  70. package/dist/types/excalidraw/actions/actionExport.d.ts +140 -364
  71. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  72. package/dist/types/excalidraw/actions/actionFrame.d.ts +157 -684
  73. package/dist/types/excalidraw/actions/actionGroup.d.ts +102 -52
  74. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +100 -21
  75. package/dist/types/excalidraw/actions/actionLink.d.ts +44 -19
  76. package/dist/types/excalidraw/actions/actionMenu.d.ts +39 -18
  77. package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -56
  78. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -23
  79. package/dist/types/excalidraw/actions/actionStyles.d.ts +44 -18
  80. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
  81. package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +58 -32
  82. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +47 -23
  83. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +196 -0
  84. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
  85. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +44 -19
  86. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +43 -23
  87. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  88. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
  89. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +44 -19
  90. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +45 -20
  91. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  92. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +44 -19
  93. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  94. package/dist/types/excalidraw/actions/index.d.ts +7 -2
  95. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  96. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  97. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  98. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  99. package/dist/types/excalidraw/appState.d.ts +44 -17
  100. package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
  101. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  102. package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
  103. package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
  104. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  105. package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
  106. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  107. package/dist/types/excalidraw/charts/index.d.ts +8 -0
  108. package/dist/types/excalidraw/clipboard.d.ts +6 -7
  109. package/dist/types/excalidraw/components/Actions.d.ts +26 -13
  110. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  111. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  112. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  113. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  114. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  115. package/dist/types/excalidraw/components/App.d.ts +376 -112
  116. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  117. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  118. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  119. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  120. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  121. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  122. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  123. package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
  124. package/dist/types/excalidraw/components/App.text.d.ts +197 -0
  125. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  126. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  127. package/dist/types/excalidraw/components/App.viewport.d.ts +133 -0
  128. package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
  129. package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
  130. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  131. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  132. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  133. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
  134. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  135. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  136. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  137. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  138. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  139. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  140. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  141. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
  142. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -3
  143. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  144. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  145. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  146. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  147. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  148. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  149. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  150. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  151. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  152. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  153. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  154. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  155. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  156. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  157. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  158. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  159. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  160. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  161. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  162. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  163. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  164. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  165. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  166. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  167. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  168. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  169. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  170. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  171. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  172. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  173. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  174. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  175. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  176. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  177. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  178. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  179. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  180. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  181. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  182. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  183. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  184. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
  185. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
  186. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  187. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
  188. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  189. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
  190. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  191. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +8 -2
  192. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
  193. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  194. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +3 -1
  195. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
  196. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
  197. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  198. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +18 -1
  199. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  200. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  201. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
  202. package/dist/types/excalidraw/components/Toast.d.ts +8 -4
  203. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  204. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  205. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  206. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  207. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  208. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  209. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  210. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  211. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  212. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -2
  213. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  214. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  215. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
  216. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
  217. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
  218. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  219. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
  220. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  221. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  222. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  223. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  224. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  225. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  226. package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
  227. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  228. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +15 -4
  229. package/dist/types/excalidraw/components/icons.d.ts +31 -10
  230. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +27 -3
  231. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
  232. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  233. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  234. package/dist/types/excalidraw/data/blob.d.ts +119 -70
  235. package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
  236. package/dist/types/excalidraw/data/index.d.ts +9 -10
  237. package/dist/types/excalidraw/data/json.d.ts +68 -35
  238. package/dist/types/excalidraw/data/library.d.ts +1 -1
  239. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  240. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  241. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  242. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  243. package/dist/types/excalidraw/history.d.ts +10 -4
  244. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  245. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  246. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  247. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  248. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  249. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  250. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  251. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  252. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  253. package/dist/types/excalidraw/renderer/animation.d.ts +15 -4
  254. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  255. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
  256. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  257. package/dist/types/excalidraw/scene/Renderer.d.ts +490 -21
  258. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  259. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  260. package/dist/types/excalidraw/scene/types.d.ts +30 -5
  261. package/dist/types/excalidraw/snapping.d.ts +7 -7
  262. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  263. package/dist/types/excalidraw/types.d.ts +702 -44
  264. package/dist/types/excalidraw/viewport.d.ts +303 -0
  265. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +17 -3
  266. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  267. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  268. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  269. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  270. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  271. package/dist/types/math/src/constants.d.ts +0 -1
  272. package/dist/types/math/src/curve.d.ts +23 -13
  273. package/dist/types/math/src/index.d.ts +1 -0
  274. package/dist/types/math/src/pca.d.ts +79 -0
  275. package/dist/types/math/src/point.d.ts +8 -2
  276. package/dist/types/math/src/polygon.d.ts +25 -1
  277. package/dist/types/math/src/segment.d.ts +6 -0
  278. package/dist/types/math/src/types.d.ts +25 -1
  279. package/dist/types/utils/src/index.d.ts +4 -3
  280. package/dist/types/utils/src/shape.d.ts +2 -2
  281. package/package.json +2 -2
  282. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  283. package/dist/types/excalidraw/charts.d.ts +0 -27
  284. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  285. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
  286. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  287. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  288. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  289. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  290. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
  291. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
  292. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  293. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  294. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
  295. package/dist/types/excalidraw/components/shapes.d.ts +0 -190
  296. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  297. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  298. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
  299. package/dist/types/excalidraw/cursor.d.ts +0 -5
  300. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  301. package/dist/types/excalidraw/index.d.ts +0 -46
  302. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  303. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  304. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  305. package/dist/types/utils/src/bbox.d.ts +0 -9
  306. package/dist/types/utils/src/export.d.ts +0 -35
  307. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,22 +1,24 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface, StrokeWidthKey } from "@excalidraw/common";
2
2
  import type { LinearElementEditor } from "@excalidraw/element";
3
- import type { MaybeTransformHandleType } from "@excalidraw/element";
4
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
3
+ import type { ListMarkerAdvance, MaybeTransformHandleType } from "@excalidraw/element";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, ExcalidrawArrowElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode, ExcalidrawTextElement, StrokeVariability } from "@excalidraw/element/types";
5
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
- import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
6
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement, RenderEnvironment, OnDuplicateData } from "@excalidraw/element";
7
+ import type { GlobalPoint } from "@excalidraw/math";
7
8
  import type { Action } from "./actions/types";
8
9
  import type { Spreadsheet } from "./charts";
9
10
  import type { ClipboardData } from "./clipboard";
10
11
  import type App from "./components/App";
11
12
  import type Library from "./data/library";
12
- import type { FileSystemHandle } from "./data/filesystem";
13
13
  import type { ContextMenuItems } from "./components/ContextMenu";
14
14
  import type { SnapLine } from "./snapping";
15
15
  import type { ImportedDataState } from "./data/types";
16
+ import type { SetViewportOptions } from "./viewport";
16
17
  import type { Language } from "./i18n";
17
18
  import type { isOverScrollBars } from "./scene/scrollbars";
18
19
  import type React from "react";
19
20
  import type { JSX } from "react";
21
+ export type { App };
20
22
  export type SocketId = string & {
21
23
  _brand: "SocketId";
22
24
  };
@@ -83,7 +85,7 @@ export type BinaryFileData = {
83
85
  };
84
86
  export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
85
87
  export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
86
- export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
88
+ export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "stickynote" | "embeddable" | "laser" | "autoshape" | "bucketfill";
87
89
  export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
88
90
  export type ActiveTool = {
89
91
  type: ToolType;
@@ -128,6 +130,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
128
130
  croppingElementId: AppState["croppingElementId"];
129
131
  }>;
130
132
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
133
+ activeTool: AppState["activeTool"];
131
134
  activeEmbeddable: AppState["activeEmbeddable"];
132
135
  selectionElement: AppState["selectionElement"];
133
136
  selectedGroupIds: AppState["selectedGroupIds"];
@@ -135,7 +138,10 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
135
138
  multiElement: AppState["multiElement"];
136
139
  newElement: AppState["newElement"];
137
140
  isBindingEnabled: AppState["isBindingEnabled"];
141
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
142
+ gridModeEnabled: AppState["gridModeEnabled"];
138
143
  suggestedBinding: AppState["suggestedBinding"];
144
+ textToolHover: AppState["textToolHover"];
139
145
  isRotating: AppState["isRotating"];
140
146
  elementsToHighlight: AppState["elementsToHighlight"];
141
147
  collaborators: AppState["collaborators"];
@@ -150,6 +156,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
150
156
  frameRendering: AppState["frameRendering"];
151
157
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
152
158
  exportScale: AppState["exportScale"];
159
+ currentItemArrowType: AppState["currentItemArrowType"];
153
160
  }>;
154
161
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
155
162
  export type ObservedStandaloneAppState = {
@@ -168,6 +175,47 @@ export type ObservedElementsAppState = {
168
175
  lockedMultiSelections: AppState["lockedMultiSelections"];
169
176
  activeLockedId: AppState["activeLockedId"];
170
177
  };
178
+ export type BoxSelectionMode = "contain" | "overlap";
179
+ /**
180
+ * The pointing device the wheel mappings are tuned for. `auto` is reserved
181
+ * for detecting it from the wheel events; see `resolveInputDevice`.
182
+ */
183
+ export type InputDevice = "auto" | "mouse" | "trackpad";
184
+ /**
185
+ * A box, in scene coordinates, that pan & zoom are constrained to.
186
+ *
187
+ * This is a private type. For public API, only use specific properties,
188
+ * needed.
189
+ */
190
+ export type ScrollConstraints = {
191
+ x: number;
192
+ y: number;
193
+ width: number;
194
+ height: number;
195
+ /** when set, panning is constrained so the viewport stays within the box */
196
+ lockScroll: boolean;
197
+ /** when set, the viewport cannot zoom out below `zoom` */
198
+ lockZoom: boolean;
199
+ /**
200
+ * The zoom resolved after the `setViewport` navigation settled.
201
+ */
202
+ zoom: number;
203
+ /**
204
+ * Pixel amount the viewport may overscroll past its resting clamp before
205
+ * snapping back (rubberband). Screen pixels, zoom-independent. Resolved
206
+ * from `lock.overscroll` at the time the lock was installed (`true` →
207
+ * default give, `false` → 0).
208
+ */
209
+ overscroll: number;
210
+ /**
211
+ * Extra scrollable margin around the box (CSS-style), letting the viewport
212
+ * scroll past each box edge to reveal that much empty space. Values are
213
+ * viewport pixels and zoom-independent (a fixed on-screen distance).
214
+ * Resolved from the `offsets` passed to `setViewport` (see
215
+ * {@link ViewportOffsets}) at the time the lock was installed.
216
+ */
217
+ offsets?: Offsets;
218
+ };
171
219
  export interface AppState {
172
220
  contextMenu: {
173
221
  items: ContextMenuItems;
@@ -201,9 +249,53 @@ export interface AppState {
201
249
  * - set on pointer down, updated during pointer move
202
250
  */
203
251
  selectionElement: NonDeletedExcalidrawElement | null;
252
+ /**
253
+ * tracking current arrow binding editor state (takes into account
254
+ * `bindingPreference` and keyboard modifiers (ctrl/alt)
255
+ */
204
256
  isBindingEnabled: boolean;
205
- startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
206
- suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
257
+ /** user box selection preference; defaults to "contain" when unset */
258
+ boxSelectionMode: BoxSelectionMode;
259
+ /** user arrow binding preference */
260
+ bindingPreference: "enabled" | "disabled";
261
+ /** user preference whether arrow snap to midpoints while binding */
262
+ isMidpointSnappingEnabled: boolean;
263
+ /** user preference whether to show contextual hints above the toolbar */
264
+ showHints: boolean;
265
+ /**
266
+ * user preference for what the wheel does: with a `trackpad` a plain wheel
267
+ * pans; with a `mouse` a plain wheel zooms. Ctrl/cmd+wheel (how a pinch is
268
+ * delivered) zooms with either device. Shift+wheel pans horizontally;
269
+ * ctrl/cmd+shift+wheel pans vertically. `auto` resolves to `trackpad` until
270
+ * device detection exists — see `resolveInputDevice`
271
+ */
272
+ inputDevice: InputDevice;
273
+ /**
274
+ * The bindable element the UI highlights for the user when an arrow is
275
+ * dragged or otherwise its endpoint being close to said element.
276
+ */
277
+ suggestedBinding: {
278
+ element: NonDeleted<ExcalidrawBindableElement>;
279
+ midPoint?: GlobalPoint;
280
+ } | null;
281
+ /**
282
+ * What a text-tool click at the hovered position would act on — the text
283
+ * it would edit, the empty container it would label, or the arrow anchor
284
+ * (a free endpoint, or the midpoint for a label) it would attach text to.
285
+ * `null` when the click would create free text, or the tool isn't active.
286
+ * Drives the hover affordance only.
287
+ */
288
+ textToolHover: {
289
+ type: "text";
290
+ elementId: ExcalidrawElement["id"];
291
+ } | {
292
+ type: "container";
293
+ elementId: ExcalidrawElement["id"];
294
+ } | {
295
+ type: "arrow";
296
+ elementId: ExcalidrawArrowElement["id"];
297
+ anchor: "start" | "end" | "label";
298
+ } | null;
207
299
  frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
208
300
  frameRendering: {
209
301
  enabled: boolean;
@@ -211,12 +303,19 @@ export interface AppState {
211
303
  outline: boolean;
212
304
  clip: boolean;
213
305
  };
214
- editingFrame: string | null;
215
- elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
306
+ /**
307
+ * frame-like element whose name is currently being edited
308
+ */
309
+ editingFrame: ExcalidrawFrameLikeElement["id"] | null;
310
+ /**
311
+ * Elements the UI highlights with a bounding-box outline — those that
312
+ * would get added to a frame being dragged/resized.
313
+ */
314
+ elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
216
315
  /**
217
316
  * set when a new text is created or when an existing text is being edited
218
317
  */
219
- editingTextElement: NonDeletedExcalidrawElement | null;
318
+ editingTextElement: ExcalidrawTextElement | null;
220
319
  activeTool: {
221
320
  /**
222
321
  * indicates a previous tool we should revert back to if we deselect the
@@ -237,11 +336,14 @@ export interface AppState {
237
336
  exportWithDarkMode: boolean;
238
337
  exportScale: number;
239
338
  currentItemStrokeColor: string;
339
+ currentItemStickynoteStrokeColor: string;
340
+ currentItemStickynoteBackgroundColor: string;
240
341
  currentItemBackgroundColor: string;
241
342
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
242
- currentItemStrokeWidth: number;
343
+ currentItemStrokeWidthKey: StrokeWidthKey;
243
344
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
244
345
  currentItemRoughness: number;
346
+ currentItemStrokeVariability: StrokeVariability;
245
347
  currentItemOpacity: number;
246
348
  currentItemFontFamily: FontFamilyValues;
247
349
  currentItemFontSize: number;
@@ -254,6 +356,7 @@ export interface AppState {
254
356
  viewBackgroundColor: string;
255
357
  scrollX: number;
256
358
  scrollY: number;
359
+ scrollConstraints: ScrollConstraints | null;
257
360
  cursorButton: "up" | "down";
258
361
  scrolledOutside: boolean;
259
362
  name: string | null;
@@ -278,6 +381,10 @@ export interface AppState {
278
381
  } | {
279
382
  name: "elementLinkSelector";
280
383
  sourceElementId: ExcalidrawElement["id"];
384
+ } | {
385
+ name: "charts";
386
+ data: Spreadsheet;
387
+ rawText: string;
281
388
  };
282
389
  /**
283
390
  * Reflects user preference for whether the default sidebar should be docked.
@@ -300,11 +407,12 @@ export interface AppState {
300
407
  selectedElementsAreBeingDragged: boolean;
301
408
  shouldCacheIgnoreZoom: boolean;
302
409
  toast: {
303
- message: string;
410
+ message: React.ReactNode;
304
411
  closable?: boolean;
305
412
  duration?: number;
306
413
  } | null;
307
414
  zenModeEnabled: boolean;
415
+ minimapEnabled: boolean;
308
416
  theme: Theme;
309
417
  /** grid cell px size */
310
418
  gridSize: number;
@@ -322,21 +430,13 @@ export interface AppState {
322
430
  height: number;
323
431
  offsetTop: number;
324
432
  offsetLeft: number;
325
- fileHandle: FileSystemHandle | null;
433
+ fileHandle: FileSystemFileHandle | null;
326
434
  collaborators: Map<SocketId, Collaborator>;
327
435
  stats: {
328
436
  open: boolean;
329
437
  /** bitmap. Use `STATS_PANELS` bit values */
330
438
  panels: number;
331
439
  };
332
- currentChartType: ChartType;
333
- pasteDialog: {
334
- shown: false;
335
- data: null;
336
- } | {
337
- shown: true;
338
- data: Spreadsheet;
339
- };
340
440
  showHyperlinkPopup: false | "info" | "editor";
341
441
  selectedLinearElement: LinearElementEditor | null;
342
442
  snapLines: readonly SnapLine[];
@@ -345,10 +445,6 @@ export interface AppState {
345
445
  y: number;
346
446
  } | null;
347
447
  objectsSnapModeEnabled: boolean;
348
- /** the user's socket id & username who is being followed on the canvas */
349
- userToFollow: UserToFollow | null;
350
- /** the socket ids of the users following the current user */
351
- followedBy: Set<SocketId>;
352
448
  /** image cropping */
353
449
  isCropping: boolean;
354
450
  croppingElementId: ExcalidrawElement["id"] | null;
@@ -363,6 +459,23 @@ export interface AppState {
363
459
  [groupId: string]: true;
364
460
  };
365
461
  bindMode: BindMode;
462
+ /** user-customized color-picker top picks (pinned via drag & drop from the
463
+ * color picker popup). `null` means no customization (defaults, or
464
+ * host-supplied `topPicks`, are used). Kept per picker. */
465
+ colorTopPicks: {
466
+ elementStroke: readonly string[] | null;
467
+ elementBackground: readonly string[] | null;
468
+ /** the bucket-fill tool keeps a list separate from `elementBackground`
469
+ * even though both drive `currentItemBackgroundColor` (its defaults and
470
+ * use case differ — no transparent) */
471
+ bucketFill: readonly string[] | null;
472
+ /** sticky notes are their own color domain (own defaults, own picks) */
473
+ stickyNoteStroke: readonly string[] | null;
474
+ stickyNoteBackground: readonly string[] | null;
475
+ };
476
+ /** user-customized font-picker top picks (pinned via drag & drop from the
477
+ * font picker popup). `null` means no customization (defaults are used) */
478
+ fontTopPicks: readonly FontFamilyValues[] | null;
366
479
  }
367
480
  export type SearchMatch = {
368
481
  id: string;
@@ -375,7 +488,7 @@ export type SearchMatch = {
375
488
  showOnCanvas: boolean;
376
489
  }[];
377
490
  };
378
- export type UIAppState = Omit<AppState, "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
491
+ export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom" | "snapLines" | "originSnapOffset" | "suggestedBinding" | "textToolHover" | "frameToHighlight" | "elementsToHighlight">;
379
492
  export type NormalizedZoomValue = number & {
380
493
  _brand: "normalizedZoom";
381
494
  };
@@ -419,15 +532,241 @@ export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePr
419
532
  export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
420
533
  libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
421
534
  }>;
535
+ export type ExcalidrawInitialState = {
536
+ viewport?: Omit<SetViewportOptions, "animation">;
537
+ };
422
538
  export type OnUserFollowedPayload = {
423
539
  userToFollow: UserToFollow;
424
540
  action: "FOLLOW" | "UNFOLLOW";
425
541
  };
542
+ export type ViewportStatusFrame = {
543
+ /** the badge (bottom-center pill) */
544
+ label?: {
545
+ label: React.ReactNode;
546
+ icon?: React.ReactNode;
547
+ /** badge background; defaults to var(--color-primary-hover) */
548
+ background?: string;
549
+ /** badge text color; defaults to var(--color-primary-light) */
550
+ color?: string;
551
+ /** makes the badge label interactive */
552
+ onClick?: () => void;
553
+ /** renders a close button when set */
554
+ onClose?: () => void;
555
+ };
556
+ /** viewport-edge border: CSS color, or `false` for none */
557
+ border: false | string;
558
+ };
559
+ export type OnExportProgress = {
560
+ type: "progress";
561
+ message?: React.ReactNode;
562
+ /** 0-1 range */
563
+ progress?: number;
564
+ };
565
+ export type InteractionConfig = {
566
+ /**
567
+ * Interactions that stay enabled while the editor is otherwise
568
+ * non-interactive. Opt-in: anything omitted or `false` is disabled.
569
+ */
570
+ enabled?: {
571
+ /**
572
+ * Element links render their link icon and stay clickable — clicking
573
+ * anywhere on a linked element opens the link, same as in view mode.
574
+ * When disabled, link icons are not rendered at all.
575
+ *
576
+ * @default false
577
+ */
578
+ links?: boolean;
579
+ /**
580
+ * Embeddable & iframe elements stay interactive — hovering & clicking
581
+ * activates them so their content can be used, same as in view mode.
582
+ *
583
+ * @default false
584
+ */
585
+ embeds?: boolean;
586
+ /**
587
+ * Umbrella for all interactive content on canvas — shorthand for
588
+ * enabling `links` & `embeds` (and future interactive content kinds)
589
+ * together. Additive: `interactiveContent: true` enables them
590
+ * regardless of their individual values.
591
+ *
592
+ * @default false
593
+ */
594
+ interactiveContent?: boolean;
595
+ /**
596
+ * Canvas navigation — panning (pointer drag, wheel, PageUp/PageDown)
597
+ * and zooming (ctrl/cmd + wheel, pinch, and the canvas zoom &
598
+ * zoom-to-fit shortcuts: ctrl/cmd +/-/0, shift+1/2/3), same as in view
599
+ * mode. Respects `appState.scrollConstraints` if set, so it composes
600
+ * with viewport locking. The rest of the keyboard stays disabled. Note
601
+ * the editor consumes wheel & touch input again when enabled, so the
602
+ * page no longer scrolls over the editor.
603
+ *
604
+ * @default false
605
+ */
606
+ navigation?: boolean;
607
+ /**
608
+ * Whether the browser's own zoom remains available over the editor —
609
+ * ctrl/cmd + wheel, pinch, and (while the editor has focus)
610
+ * ctrl/cmd +/-/0 shortcuts. Prevented by default, mirroring the
611
+ * interactive editor. Regular page scrolling stays available either way.
612
+ * With `navigation` enabled, the zoom input (wheel, pinch, keyboard
613
+ * shortcuts) zooms the canvas instead either way, making this moot.
614
+ *
615
+ * @default false
616
+ */
617
+ browserZoom?: boolean;
618
+ /**
619
+ * Tools that stay user-driven while the editor is otherwise
620
+ * non-interactive: pointer input keeps driving the listed tool when it's
621
+ * the active tool. Does not enable user-driven tool *switching* — the
622
+ * keyboard stays disabled and tool selection remains host-driven
623
+ * (`ExcalidrawAPI.setActiveTool`).
624
+ *
625
+ * Composes with `navigation`: the enabled tool wins the primary-pointer
626
+ * drag, while wheel input (and wheel-button drag) still pans/zooms.
627
+ */
628
+ tools?: {
629
+ /**
630
+ * The laser pointer stays usable — pointer strokes draw laser trails
631
+ * and pointer positions keep broadcasting via `onPointerUpdate`, so
632
+ * e.g. collaborators see a presenter's laser & cursor.
633
+ *
634
+ * @default false
635
+ */
636
+ laser?: boolean;
637
+ /**
638
+ * Custom tools (`activeTool.type === "custom"`) stay usable — the
639
+ * editor keeps dispatching `onPointerDown` / `onPointerUp` for them.
640
+ * Tool behavior is host-implemented; activate custom tools with
641
+ * `locked: true` or they revert to the selection tool (and go inert)
642
+ * after the first pointer interaction.
643
+ *
644
+ * @default false
645
+ */
646
+ custom?: boolean;
647
+ };
648
+ };
649
+ };
650
+ export type UIConfig = {
651
+ /**
652
+ * Default UI controls that stay enabled while the rest of Excalidraw's
653
+ * default UI is hidden. Opt-in: anything omitted or `false` is
654
+ * disabled.
655
+ */
656
+ enabled: {
657
+ /**
658
+ * The zoom controls (zoom out, the zoom level resetting it, zoom in).
659
+ *
660
+ * @default false
661
+ */
662
+ zoom?: boolean;
663
+ /**
664
+ * The button shown when the viewport is scrolled away from all
665
+ * content.
666
+ *
667
+ * @default false
668
+ */
669
+ scrollBackToContent?: boolean;
670
+ };
671
+ } | {
672
+ /**
673
+ * Default UI controls that are removed while the rest of Excalidraw's
674
+ * default UI is rendered. Opt-out: anything omitted or `false` stays.
675
+ */
676
+ disabled: {
677
+ /**
678
+ * The minimap, and every way to toggle it (its footer button, the
679
+ * Preferences menu item, and the command palette and context menu
680
+ * entries). Without the minimap toggle next to them, the zoom
681
+ * controls are the zoom out / zoom level / zoom in buttons instead of
682
+ * the zoom menu.
683
+ *
684
+ * @default false
685
+ */
686
+ minimap?: boolean;
687
+ };
688
+ };
689
+ /** A default UI control that `UIConfig` can keep or remove. */
690
+ export type UIControl = keyof Extract<UIConfig, {
691
+ enabled: unknown;
692
+ }>["enabled"] | keyof Extract<UIConfig, {
693
+ disabled: unknown;
694
+ }>["disabled"];
695
+ /** Supported visual changes. Geometry, content, bindings and styles are not overridable. */
696
+ export type ElementRenderOverride = Readonly<{
697
+ /** Absolute render opacity (0–100, clamped). Omitted: use element.opacity. */
698
+ opacity?: number;
699
+ /** Translation in scene units. Bound labels inherit their container's offset and ignore this field. */
700
+ offset?: Readonly<{
701
+ x: number;
702
+ y: number;
703
+ }>;
704
+ }>;
705
+ /** see {@link ExcalidrawImperativeAPI.setElementRenderOverrides} for details */
706
+ export type ElementRenderOverrides = ReadonlyMap<ExcalidrawElement["id"], ElementRenderOverride>;
707
+ /** The translation part of a snapshot: only the entries that carry an offset. */
708
+ export type ElementRenderOffsets = ReadonlyMap<ExcalidrawElement["id"], NonNullable<ElementRenderOverride["offset"]>>;
426
709
  export interface ExcalidrawProps {
710
+ className?: string;
711
+ /**
712
+ * Document that owns Excalidraw's mounted DOM.
713
+ *
714
+ * Set only when it differs from the global `document`, such as when code
715
+ * executing in a parent window mounts Excalidraw into an iframe document.
716
+ * The value must remain stable for the editor's lifetime.
717
+ *
718
+ * @default document
719
+ */
720
+ ownerDocument?: Document;
721
+ /**
722
+ * Host environment used by the renderer and export pipeline to create
723
+ * canvases and images. Supply a custom implementation to redirect canvas
724
+ * creation and image decoding to e.g. a host canvas pool, an
725
+ * `OffscreenCanvas`, or a non-DOM image decoder. When omitted, canvas and
726
+ * image creation fall back to `ownerDocument` / `ownerWindow`.
727
+ *
728
+ * The value must be referentially stable -- every render cache (element
729
+ * canvases, text metrics, char widths, link icons) is keyed by this
730
+ * object's identity, so a new identity is a full cache miss. Passing an
731
+ * inline object literal mints a fresh identity on every React render,
732
+ * which silently re-rasterizes every element on every frame; hoist it to a
733
+ * module constant or memoize it (e.g. `useMemo`) instead.
734
+ *
735
+ * Only `createCanvas` and `createImage` are required. `createPath` (used to
736
+ * fill freedraw strokes) falls back to the global `Path2D`, which every
737
+ * browser has -- a non-browser host without one must supply it. Pass
738
+ * `document` (the owner document) for SVG exports to be built in it rather
739
+ * than in the global `document`, and `textMetrics` to measure the editor's
740
+ * text with your own provider.
741
+ *
742
+ * @default { createCanvas: () => ownerDocument.createElement("canvas"), createImage: () => new ownerWindow.Image(), createPath: (d) => new ownerWindow.Path2D(d), document: ownerDocument }
743
+ */
744
+ renderEnvironment?: RenderEnvironment;
427
745
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
746
+ onThemeChange?: (theme: Theme | "system") => void;
747
+ /**
748
+ * note: only subscribes if the props.onIncrement is defined on initial render
749
+ */
428
750
  onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
429
751
  initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
430
- excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
752
+ initialState?: ExcalidrawInitialState;
753
+ /**
754
+ * Invoked as soon as the Excalidraw API is available
755
+ * NOTE editor is not yet mounted, and state is not yet initialized
756
+ */
757
+ onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
758
+ /**
759
+ * Invoked once the editor root is mounted.
760
+ */
761
+ onMount?: (payload: ExcalidrawMountPayload) => void;
762
+ /**
763
+ * Invoked when the editor root is unmounted.
764
+ */
765
+ onUnmount?: () => void;
766
+ /**
767
+ * Invoked once the initial scene is loaded.
768
+ */
769
+ onInitialize?: (api: ExcalidrawImperativeAPI) => void;
431
770
  isCollaborating?: boolean;
432
771
  onPointerUpdate?: (payload: {
433
772
  pointer: {
@@ -448,15 +787,97 @@ export interface ExcalidrawProps {
448
787
  *
449
788
  * Returned elements will be used in place of the next elements
450
789
  * (you should return all elements, including deleted, and not mutate
451
- * the element if changes are made)
790
+ * the element if changes are made).
791
+ *
792
+ * The duplicates are the elements in `nextElements` which are not in
793
+ * `prevElements` (see also `data.duplicateElements`). When pasting or
794
+ * inserting onto a frame, their `frameId` is already set. To change a
795
+ * duplicate, return a new object with the same `id`. It is shallow-merged
796
+ * into the duplicate (omitted properties are kept), and your changes are
797
+ * part of the duplication itself (same undo entry, same durable increment).
798
+ *
799
+ * To prevent an element from being duplicated, omit its duplicate from the
800
+ * returned array. References to it from the remaining duplicates are
801
+ * cleared, and a bound text isn't duplicated without its container. To
802
+ * prevent the duplication as a whole, return `false`. If no duplicate
803
+ * remains, the duplication is cancelled and the returned elements are
804
+ * ignored (alt-drag then moves the original elements instead).
452
805
  */
453
806
  onDuplicate?: (nextElements: readonly ExcalidrawElement[],
454
807
  /** excludes the duplicated elements */
455
- prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
808
+ prevElements: readonly ExcalidrawElement[],
809
+ /** lookups covering just the elements taking part in the duplication */
810
+ data: OnDuplicateData) => ExcalidrawElement[] | void | false;
456
811
  renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
457
812
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
458
813
  langCode?: Language["code"];
459
814
  viewModeEnabled?: boolean;
815
+ /**
816
+ * Whether the editor accepts user input (pointer, keyboard, wheel, touch,
817
+ * clipboard, drag&drop). When `false`, the scene still renders and reacts
818
+ * to programmatic updates (imperative API), but the user cannot affect it
819
+ * in any way. Implies view mode.
820
+ *
821
+ * Pass a config object to keep specific interactions enabled while the
822
+ * editor is otherwise non-interactive (see `InteractionConfig`):
823
+ *
824
+ * ```tsx
825
+ * <Excalidraw interaction={{ enabled: { links: true } }} />
826
+ * ```
827
+ *
828
+ * @default true
829
+ */
830
+ interaction?: boolean | InteractionConfig;
831
+ /**
832
+ * Whether Excalidraw's default UI is rendered — toolbar, default menus,
833
+ * footer controls, sidebars, and canvas popups. Host UI passed through
834
+ * children (including exported components such as `MainMenu` and `Footer`)
835
+ * or render props continues to render, together with any supporting dialogs
836
+ * it opens.
837
+ *
838
+ * Canvas content (elements, text editing surface, frame names, embeds) still
839
+ * renders, and the editor remains interactive unless `interaction` is set to
840
+ * `false`.
841
+ *
842
+ * Pass a config object to keep specific default controls rendered while the
843
+ * rest of the default UI is hidden, or to remove specific controls from the
844
+ * otherwise full default UI (see `UIConfig`):
845
+ *
846
+ * ```tsx
847
+ * <Excalidraw ui={{ enabled: { zoom: true } }} />
848
+ * <Excalidraw ui={{ disabled: { minimap: true } }} />
849
+ * ```
850
+ *
851
+ * NOTE: this is WIP and what default UI is/is not rendered when ui=false
852
+ * may yet change.
853
+ *
854
+ * @default true
855
+ */
856
+ ui?: boolean | UIConfig;
857
+ /**
858
+ * Forces the active editor tool (controlled). While set, user- and
859
+ * API-driven tool switching is ignored — `setActiveTool` refuses with a
860
+ * console warning, non-forced toolbar buttons render disabled — and the
861
+ * editor snaps back if internal flows reset the tool. The forced tool
862
+ * behaves as if locked (see the tool lock / padlock): it doesn't revert to
863
+ * the selection tool after use, and elements drawn with it aren't
864
+ * auto-selected — without mutating `appState.activeTool.locked`, so the
865
+ * user's persisted padlock preference stays untouched. Unset to return
866
+ * tool control to the editor (the current tool stays active).
867
+ *
868
+ * The forced tool must be activatable to take effect: not disabled via
869
+ * `UIOptions.tools`, and — while the editor is non-interactive — allowed
870
+ * via `interaction.enabled.tools`. Otherwise the editor stays on (or, when
871
+ * non-interactive, resets to) the `selection` tool, and the forced tool is
872
+ * applied once it becomes activatable. `image` cannot be forced (its
873
+ * activation opens the file picker).
874
+ */
875
+ activeTool?: {
876
+ type: Exclude<ToolType, "image">;
877
+ } | {
878
+ type: "custom";
879
+ customType: string;
880
+ };
460
881
  zenModeEnabled?: boolean;
461
882
  gridModeEnabled?: boolean;
462
883
  objectsSnapModeEnabled?: boolean;
@@ -465,6 +886,10 @@ export interface ExcalidrawProps {
465
886
  name?: string;
466
887
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
467
888
  UIOptions?: Partial<UIOptions>;
889
+ /**
890
+ * dimensions and size constraints for inserted images
891
+ */
892
+ imageOptions?: ImageOptions;
468
893
  detectScroll?: boolean;
469
894
  handleKeyboardGlobally?: boolean;
470
895
  onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
@@ -484,9 +909,48 @@ export interface ExcalidrawProps {
484
909
  aiEnabled?: boolean;
485
910
  showDeprecatedFonts?: boolean;
486
911
  renderScrollbars?: boolean;
912
+ viewportStatusFrame?: ViewportStatusFrame | null;
913
+ /**
914
+ * Rendered inside the UserList "who's here" dropdown (desktop) and inline
915
+ * in the mobile menu's collaborators section, below a divider. Accepts a
916
+ * render function — called with `isMobile` so hosts can render different
917
+ * UI for each surface — in addition to a plain node.
918
+ */
919
+ currentUserControls?: React.ReactNode | ((isMobile: boolean) => React.ReactNode);
920
+ /**
921
+ * The user being followed on the canvas, if any. Controlled by the host —
922
+ * the editor never sets it; it emits follow/unfollow intents via
923
+ * `onUserFollow` (prop or imperative API) and renders the followed
924
+ * user's avatar highlight from this value.
925
+ */
926
+ userToFollow?: UserToFollow | null;
927
+ /**
928
+ * Called before exporting to a file.
929
+ *
930
+ * Allows the host app to intercept and delay saving until async operations
931
+ * (e.g., images are loaded) complete.
932
+ *
933
+ * If Promise/AsyncGenerator is returned, a progress toast will be shown
934
+ * until the operation completes. Generator can yield progress updates.
935
+ */
936
+ onExport?: (
937
+ /** type of export. Currently we only call for JSON exports or
938
+ * JSON-embedded PNG (which is also identified as `json` type here)*/
939
+ type: "json", data: {
940
+ elements: readonly ExcalidrawElement[];
941
+ appState: AppState;
942
+ files: BinaryFiles;
943
+ }, options: {
944
+ /** signal that gets aborted if user cancels the export (e.g. closes
945
+ * the native file picker dialog). In that case, you can either
946
+ * return immediately, or throw AbortError.
947
+ */
948
+ signal: AbortSignal;
949
+ }) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
487
950
  }
488
951
  export type SceneData = {
489
- elements?: ImportedDataState["elements"];
952
+ /** Expects normalized elements; restore imported data before updating the scene. */
953
+ elements?: readonly ExcalidrawElement[] | null;
490
954
  appState?: ImportedDataState["appState"];
491
955
  collaborators?: Map<SocketId, Collaborator>;
492
956
  captureUpdate?: CaptureUpdateActionType;
@@ -496,12 +960,21 @@ export type ExportOpts = {
496
960
  onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
497
961
  renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
498
962
  };
963
+ export type ImageOptions = Partial<{
964
+ maxWidthOrHeight: number;
965
+ maxFileSizeBytes: number;
966
+ }>;
499
967
  export type CanvasActions = Partial<{
500
968
  changeViewBackgroundColor: boolean;
501
969
  clearCanvas: boolean;
502
970
  export: false | ExportOpts;
503
971
  loadScene: boolean;
504
972
  saveToActiveFile: boolean;
973
+ /**
974
+ * defaults to true if `props.theme` is omitted or `props.onThemeChange`
975
+ * is supplied (at which point the theme is considered as host-app controlled),
976
+ * else default to false
977
+ * */
505
978
  toggleTheme: boolean | null;
506
979
  saveAsImage: boolean;
507
980
  }>;
@@ -525,6 +998,7 @@ export type AppProps = Merge<ExcalidrawProps, {
525
998
  export: ExportOpts;
526
999
  };
527
1000
  }>;
1001
+ imageOptions: Required<ImageOptions>;
528
1002
  detectScroll: boolean;
529
1003
  handleKeyboardGlobally: boolean;
530
1004
  isCollaborating: boolean;
@@ -536,6 +1010,11 @@ export type AppProps = Merge<ExcalidrawProps, {
536
1010
  export type AppClassProperties = {
537
1011
  props: AppProps;
538
1012
  state: AppState;
1013
+ readonly ownerDocument: Document;
1014
+ readonly ownerWindow: Window & typeof globalThis;
1015
+ renderEnvironment: RenderEnvironment;
1016
+ api: App["api"];
1017
+ sessionExportThemeOverride: App["sessionExportThemeOverride"];
539
1018
  interactiveCanvas: HTMLCanvasElement | null;
540
1019
  /** static canvas */
541
1020
  canvas: HTMLCanvasElement;
@@ -550,12 +1029,12 @@ export type AppClassProperties = {
550
1029
  scene: App["scene"];
551
1030
  syncActionResult: App["syncActionResult"];
552
1031
  fonts: App["fonts"];
553
- pasteFromClipboard: App["pasteFromClipboard"];
1032
+ clipboard: App["clipboard"];
554
1033
  id: App["id"];
555
1034
  onInsertElements: App["onInsertElements"];
556
1035
  onExportImage: App["onExportImage"];
557
- lastViewportPosition: App["lastViewportPosition"];
558
- scrollToContent: App["scrollToContent"];
1036
+ viewport: App["viewport"];
1037
+ wheel: App["wheel"];
559
1038
  addFiles: App["addFiles"];
560
1039
  addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
561
1040
  togglePenMode: App["togglePenMode"];
@@ -566,17 +1045,39 @@ export type AppClassProperties = {
566
1045
  onMagicframeToolSelect: App["onMagicframeToolSelect"];
567
1046
  getName: App["getName"];
568
1047
  dismissLinearEditor: App["dismissLinearEditor"];
569
- flowChartCreator: App["flowChartCreator"];
1048
+ flowchart: App["flowchart"];
1049
+ drawShape: App["drawShape"];
1050
+ arrowText: App["arrowText"];
1051
+ text: App["text"];
1052
+ textTool: App["textTool"];
1053
+ cursor: App["cursor"];
1054
+ bucketFill: App["bucketFill"];
1055
+ duplicate: App["duplicate"];
1056
+ toolDrag: App["toolDrag"];
1057
+ activeResizeHandle: App["activeResizeHandle"];
1058
+ selectionTool: App["selectionTool"];
1059
+ wrap: App["wrap"];
1060
+ modifiers: App["modifiers"];
1061
+ isToolLocked: App["isToolLocked"];
570
1062
  getEffectiveGridSize: App["getEffectiveGridSize"];
571
1063
  setPlugins: App["setPlugins"];
572
1064
  plugins: App["plugins"];
573
- getEditorUIOffsets: App["getEditorUIOffsets"];
574
1065
  visibleElements: App["visibleElements"];
575
1066
  excalidrawContainerValue: App["excalidrawContainerValue"];
576
1067
  onPointerUpEmitter: App["onPointerUpEmitter"];
577
1068
  updateEditorAtom: App["updateEditorAtom"];
578
1069
  onPointerDownEmitter: App["onPointerDownEmitter"];
1070
+ onEvent: App["onEvent"];
1071
+ onStateChange: App["onStateChange"];
1072
+ lastPointerMoveCoords: App["lastPointerMoveCoords"];
1073
+ lastPointerMoveEvent: App["lastPointerMoveEvent"];
579
1074
  bindModeHandler: App["bindModeHandler"];
1075
+ emitUserFollowIntent: App["emitUserFollowIntent"];
1076
+ requestUnfollow: App["requestUnfollow"];
1077
+ setAppState: App["setAppState"];
1078
+ isInteractionEnabled: App["isInteractionEnabled"];
1079
+ isNavigationEnabled: App["isNavigationEnabled"];
1080
+ isUIControlEnabled: App["isUIControlEnabled"];
580
1081
  };
581
1082
  export type PointerDownState = Readonly<{
582
1083
  origin: Readonly<{
@@ -610,8 +1111,12 @@ export type PointerDownState = Readonly<{
610
1111
  element: NonDeleted<ExcalidrawElement> | null;
611
1112
  allHitElements: NonDeleted<ExcalidrawElement>[];
612
1113
  wasAddedToSelection: boolean;
1114
+ cycleTarget: NonDeleted<ExcalidrawElement> | null;
613
1115
  hasBeenDuplicated: boolean;
1116
+ advancedListMarkers: readonly ListMarkerAdvance[];
1117
+ editedTextId: ExcalidrawTextElement["id"] | null;
614
1118
  hasHitCommonBoundingBoxOfSelectedElements: boolean;
1119
+ arrowLabel: boolean;
615
1120
  };
616
1121
  withCmdOrCtrl: boolean;
617
1122
  drag: {
@@ -624,6 +1129,10 @@ export type PointerDownState = Readonly<{
624
1129
  x: number;
625
1130
  y: number;
626
1131
  };
1132
+ lastOffset: {
1133
+ x: number;
1134
+ y: number;
1135
+ };
627
1136
  blockDragging: boolean;
628
1137
  };
629
1138
  eventListeners: {
@@ -637,7 +1146,18 @@ export type PointerDownState = Readonly<{
637
1146
  };
638
1147
  }>;
639
1148
  export type UnsubscribeCallback = () => void;
1149
+ export type ExcalidrawMountPayload = {
1150
+ excalidrawAPI: ExcalidrawImperativeAPI;
1151
+ container: HTMLDivElement | null;
1152
+ };
1153
+ export type ExcalidrawImperativeAPIEventMap = {
1154
+ "editor:mount": [payload: ExcalidrawMountPayload];
1155
+ "editor:initialize": [api: ExcalidrawImperativeAPI];
1156
+ "editor:unmount": [];
1157
+ };
640
1158
  export interface ExcalidrawImperativeAPI {
1159
+ /** Whether the editor has been unmounted and the API is no longer usable. */
1160
+ isDestroyed: boolean;
641
1161
  updateScene: InstanceType<typeof App>["updateScene"];
642
1162
  applyDeltas: InstanceType<typeof App>["applyDeltas"];
643
1163
  mutateElement: InstanceType<typeof App>["mutateElement"];
@@ -648,19 +1168,51 @@ export interface ExcalidrawImperativeAPI {
648
1168
  history: {
649
1169
  clear: InstanceType<typeof App>["resetHistory"];
650
1170
  };
1171
+ /**
1172
+ * Selects elements (or their ids — one or many), adds them to or removes
1173
+ * them from the selection, or clears it — as the editor does: an element is
1174
+ * selected with its group (unless `deep`), a frame and its children aren't
1175
+ * selected at the same time, and locked elements are skipped (unless
1176
+ * `includeLocked`). Text editing and cropping end, and the link popup of a
1177
+ * lone selected element shows. Missing and deleted elements are skipped.
1178
+ *
1179
+ * By default the change is recorded for undo along with the next undoable
1180
+ * change — pass `captureUpdate` as for `updateScene()` otherwise. Like
1181
+ * `updateScene()`, it applies on the next render: read it back through
1182
+ * `onChange()` or `getAppState()` after that. Works in view mode too, where
1183
+ * the selection shows without transform handles.
1184
+ */
1185
+ selection: Pick<InstanceType<typeof App>["selection"], "select" | "add" | "remove" | "clear">;
651
1186
  getSceneElements: InstanceType<typeof App>["getSceneElements"];
652
1187
  getAppState: () => InstanceType<typeof App>["state"];
653
1188
  getFiles: () => InstanceType<typeof App>["files"];
654
1189
  getName: InstanceType<typeof App>["getName"];
655
- scrollToContent: InstanceType<typeof App>["scrollToContent"];
1190
+ setViewport: InstanceType<typeof App>["viewport"]["setViewport"];
1191
+ getViewportOffsets: InstanceType<typeof App>["viewport"]["getOffsets"];
1192
+ /**
1193
+ * Atomically replaces all transient visual overrides. Values are copied;
1194
+ * omitted IDs/fields use document values, except for inherited label offsets.
1195
+ * null clears the snapshot.
1196
+ * Repaints without document changes, history entries or onChange events;
1197
+ * an equivalent snapshot may still repaint (clearing an already clear
1198
+ * snapshot does not), so submit only when something changed.
1199
+ * Finite opacity is clamped to 0–100; non-finite values reject the snapshot.
1200
+ * Unknown/deleted IDs are ignored when rendering. Reset/unmount clears it.
1201
+ * Bound labels inherit their container's offset; offsets targeting them are
1202
+ * ignored. Label opacity remains independent. Target frame children explicitly.
1203
+ * Frame opacity still multiplies child opacity. Decorations follow their owner.
1204
+ * Exports and interactive geometry (hit tests, selection, editing) use document
1205
+ * values, including while authoring an animation preview in edit mode.
1206
+ */
1207
+ setElementRenderOverrides: InstanceType<typeof App>["setElementRenderOverrides"];
656
1208
  registerAction: (action: Action) => void;
657
1209
  refresh: InstanceType<typeof App>["refresh"];
658
1210
  setToast: InstanceType<typeof App>["setToast"];
659
1211
  addFiles: (data: BinaryFileData[]) => void;
660
1212
  id: string;
661
1213
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
662
- setCursor: InstanceType<typeof App>["setCursor"];
663
- resetCursor: InstanceType<typeof App>["resetCursor"];
1214
+ setCursor: InstanceType<typeof App>["cursor"]["set"];
1215
+ resetCursor: InstanceType<typeof App>["cursor"]["reset"];
664
1216
  toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
665
1217
  getEditorInterface: () => EditorInterface;
666
1218
  /**
@@ -675,13 +1227,14 @@ export interface ExcalidrawImperativeAPI {
675
1227
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
676
1228
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
677
1229
  onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
1230
+ onStateChange: InstanceType<typeof App>["onStateChange"];
1231
+ onEvent: InstanceType<typeof App>["onEvent"];
678
1232
  }
679
1233
  export type FrameNameBounds = {
680
1234
  x: number;
681
1235
  y: number;
682
1236
  width: number;
683
1237
  height: number;
684
- angle: number;
685
1238
  };
686
1239
  export type FrameNameBoundsCache = {
687
1240
  get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
@@ -700,12 +1253,18 @@ export type Primitive = number | string | boolean | bigint | symbol | null | und
700
1253
  export type JSONValue = string | number | boolean | null | object;
701
1254
  export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
702
1255
  export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
703
- export type PendingExcalidrawElements = ExcalidrawElement[];
1256
+ export type PendingExcalidrawElements = NonDeletedExcalidrawElement[];
704
1257
  /** Runtime gridSize value. Null indicates disabled grid. */
705
1258
  export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
706
1259
  export type GenerateDiagramToCode = (props: {
707
- frame: ExcalidrawMagicFrameElement;
708
- children: readonly ExcalidrawElement[];
1260
+ frame: NonDeleted<ExcalidrawMagicFrameElement>;
1261
+ children: readonly NonDeletedExcalidrawElement[];
1262
+ /**
1263
+ * Optional streaming hook. Call with the accumulated response text as it
1264
+ * streams in so the editor can progressively render the partial HTML
1265
+ * inside the generated frame.
1266
+ */
1267
+ onPartial?: (html: string) => void;
709
1268
  }) => MaybePromise<{
710
1269
  html: string;
711
1270
  }>;
@@ -715,4 +1274,103 @@ export type Offsets = Partial<{
715
1274
  bottom: number;
716
1275
  left: number;
717
1276
  }>;
718
- export {};
1277
+ /**
1278
+ * Value of the `data-viewport-ui` attribute, marking a DOM node as a UI
1279
+ * surface that occludes the canvas. Such nodes are measured by
1280
+ * `getViewportOffsets` to compute the default per-side viewport offsets:
1281
+ *
1282
+ * - `top` / `bottom` — offsets that side by the node's bottom/top edge
1283
+ * - `side` — a panel hugging the left or right edge. Which side is not
1284
+ * declared but resolved geometrically: if the node's horizontal center
1285
+ * lies in the left half of the viewport it counts against the left
1286
+ * offset (by its right edge), otherwise against the right offset (by
1287
+ * `viewportWidth - left edge`). Measuring the rendered position instead
1288
+ * of declaring a side means RTL layouts and host-configurable docking
1289
+ * (e.g. sidebar side) are handled for free — but it assumes the surface
1290
+ * actually hugs one edge; don't mark a centered/near-full-width node as
1291
+ * `side` (its midpoint would classify it to one side and the offset
1292
+ * would swallow most of the viewport).
1293
+ *
1294
+ * The attribute should only be present while the surface is actually
1295
+ * rendered — omit it (don't just hide the node) when the surface shouldn't
1296
+ * push the viewport around.
1297
+ */
1298
+ export type ViewportUIDock = "top" | "bottom" | "side";
1299
+ /**
1300
+ * Options for `getViewportOffsets` (and the `ui` key of
1301
+ * {@link ViewportOffsets}), controlling how offsets are derived from the
1302
+ * currently rendered editor UI.
1303
+ *
1304
+ * NOTE unlike the physical sides of {@link Offsets}, the horizontal values
1305
+ * here are logical, i.e. flipped in RTL layouts (`left` refers to the
1306
+ * reading-direction start side).
1307
+ */
1308
+ export type ViewportOffsetsOptions = {
1309
+ /** padding added to each measured side (default 24) */
1310
+ padding?: number;
1311
+ paddingTop?: number;
1312
+ paddingRight?: number;
1313
+ paddingBottom?: number;
1314
+ paddingLeft?: number;
1315
+ /** final value for the given side, replacing the measured UI size
1316
+ * (padding is not added on top) */
1317
+ top?: number;
1318
+ bottom?: number;
1319
+ left?: number;
1320
+ right?: number;
1321
+ /**
1322
+ * Reserve space for the given conditionally-rendered surfaces even while
1323
+ * they're hidden, so the resulting offsets don't shift when they
1324
+ * (dis)appear. Uses the surface's last-measured footprint, falling back
1325
+ * to an approximate default if it hasn't been rendered yet. Ignored on
1326
+ * phones (where these surfaces never occlude the canvas).
1327
+ */
1328
+ reserve?: {
1329
+ /** styles panel (rendered when a tool or selection is active) */
1330
+ stylesPanel?: boolean;
1331
+ /** sidebar (e.g. library) */
1332
+ sidebar?: boolean;
1333
+ };
1334
+ };
1335
+ /**
1336
+ * Viewport offsets accepted by the `setViewport`-family APIs (`setViewport`,
1337
+ * `props.initialState.viewport`), insetting the usable viewport area per
1338
+ * side so the target isn't fitted/centered underneath overlaid UI.
1339
+ *
1340
+ * Two (combinable) ways to specify:
1341
+ *
1342
+ * - **Static sides** (`top`/`right`/`bottom`/`left`) — absolute pixel
1343
+ * values, used as-is: physical (not flipped in RTL), zoom-independent,
1344
+ * no padding added. Sides not specified default to `0` (unless `ui` is
1345
+ * set, see below).
1346
+ *
1347
+ * - **`ui`** — derive the offsets from the editor UI (toolbar, styles
1348
+ * panel, sidebar...) as rendered at the time the viewport is set,
1349
+ * equivalent to calling `getViewportOffsets()`. Pass `true` for the
1350
+ * defaults, or options ({@link ViewportOffsetsOptions}) to customize
1351
+ * padding or reserve space for currently-hidden surfaces.
1352
+ *
1353
+ * When both are given, a static side always wins for that side — it
1354
+ * replaces whatever `ui` would yield (including `ui`'s own side overrides,
1355
+ * which — unlike the physical static sides — are RTL-relative). The
1356
+ * remaining sides fall back to the `ui`-derived values.
1357
+ *
1358
+ * @example
1359
+ * { top: 40 } // top 40px, other sides 0
1360
+ * { ui: true } // measured UI + default padding
1361
+ * { ui: { reserve: { stylesPanel: true } } } // + keep space for hidden panel
1362
+ * { top: 40, ui: true } // top exactly 40px, rest from UI
1363
+ */
1364
+ export type ViewportOffsets = Offsets & {
1365
+ ui?: true | ViewportOffsetsOptions;
1366
+ };
1367
+ /**
1368
+ * Value of the `data-viewport-ui-name` attribute, identifying a
1369
+ * conditionally-rendered surface (marked with `data-viewport-ui`) so that
1370
+ * it can be measured on its own, and so that `getViewportOffsets` can
1371
+ * reserve space for it while it's hidden (see the `reserve` option).
1372
+ * Whenever a named surface is rendered, its measured footprint is
1373
+ * remembered; reserving uses that remembered footprint, or an approximate
1374
+ * default if the surface hasn't been rendered yet.
1375
+ */
1376
+ export type ViewportUIName = "sidebar" | "stylesPanel" | "stats";