@zsviczian/excalidraw 0.18.0-18 → 0.18.0-19

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 (387) hide show
  1. package/dist/excalidraw.development.js +98 -98
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +5 -2
  4. package/types/common/src/binary-heap.d.ts +12 -12
  5. package/types/common/src/colors.d.ts +62 -62
  6. package/types/common/src/constants.d.ts +344 -344
  7. package/types/common/src/emitter.d.ts +16 -16
  8. package/types/common/src/font-metadata.d.ts +48 -48
  9. package/types/common/src/index.d.ts +12 -12
  10. package/types/common/src/keys.d.ts +189 -189
  11. package/types/common/src/points.d.ts +9 -9
  12. package/types/common/src/promise-pool.d.ts +6 -6
  13. package/types/common/src/queue.d.ts +9 -9
  14. package/types/common/src/random.d.ts +4 -4
  15. package/types/common/src/url.d.ts +7 -7
  16. package/types/common/src/utility-types.d.ts +37 -37
  17. package/types/common/src/utils.d.ts +269 -269
  18. package/types/element/src/Scene.d.ts +76 -76
  19. package/types/element/src/Shape.d.ts +17 -17
  20. package/types/element/src/ShapeCache.d.ts +25 -25
  21. package/types/element/src/align.d.ts +7 -7
  22. package/types/element/src/binding.d.ts +108 -108
  23. package/types/element/src/bounds.d.ts +81 -81
  24. package/types/element/src/collision.d.ts +26 -26
  25. package/types/element/src/comparisons.d.ts +8 -8
  26. package/types/element/src/containerCache.d.ts +11 -11
  27. package/types/element/src/cropElement.d.ts +19 -19
  28. package/types/element/src/delta.d.ts +196 -196
  29. package/types/element/src/distance.d.ts +3 -3
  30. package/types/element/src/distribute.d.ts +6 -6
  31. package/types/element/src/dragElements.d.ts +33 -33
  32. package/types/element/src/duplicate.d.ts +63 -63
  33. package/types/element/src/easingFunctions.d.ts +6 -6
  34. package/types/element/src/elbowArrow.d.ts +17 -17
  35. package/types/element/src/elementLink.d.ts +13 -13
  36. package/types/element/src/embeddable.d.ts +10 -10
  37. package/types/element/src/flowchart.d.ts +26 -26
  38. package/types/element/src/fractionalIndex.d.ts +51 -51
  39. package/types/element/src/frame.d.ts +70 -70
  40. package/types/element/src/groups.d.ts +33 -33
  41. package/types/element/src/heading.d.ts +15 -15
  42. package/types/element/src/image.d.ts +32 -32
  43. package/types/element/src/index.d.ts +59 -59
  44. package/types/element/src/linearElementEditor.d.ts +117 -117
  45. package/types/element/src/mutateElement.d.ts +21 -21
  46. package/types/element/src/newElement.d.ts +63 -63
  47. package/types/element/src/renderElement.d.ts +28 -28
  48. package/types/element/src/resizeElements.d.ts +38 -38
  49. package/types/element/src/resizeTest.d.ts +15 -15
  50. package/types/element/src/selection.d.ts +38 -38
  51. package/types/element/src/shapes.d.ts +27 -27
  52. package/types/element/src/showSelectedShapeActions.d.ts +3 -3
  53. package/types/element/src/sizeHelpers.d.ts +35 -35
  54. package/types/element/src/sortElements.d.ts +2 -2
  55. package/types/element/src/store.d.ts +227 -227
  56. package/types/element/src/textElement.d.ts +40 -40
  57. package/types/element/src/textMeasurements.d.ts +41 -41
  58. package/types/element/src/textWrapping.d.ts +13 -13
  59. package/types/element/src/transformHandles.d.ts +55 -55
  60. package/types/element/src/typeChecks.d.ts +53 -53
  61. package/types/element/src/types.d.ts +298 -298
  62. package/types/element/src/utils.d.ts +21 -21
  63. package/types/element/src/zindex.d.ts +7 -7
  64. package/types/excalidraw/actions/actionAddToLibrary.d.ts +638 -638
  65. package/types/excalidraw/actions/actionAlign.d.ts +109 -109
  66. package/types/excalidraw/actions/actionBoundText.d.ts +462 -462
  67. package/types/excalidraw/actions/actionCanvas.d.ts +3323 -3323
  68. package/types/excalidraw/actions/actionClipboard.d.ts +1392 -1392
  69. package/types/excalidraw/actions/actionCropEditor.d.ts +225 -225
  70. package/types/excalidraw/actions/actionDeleteSelected.d.ts +677 -677
  71. package/types/excalidraw/actions/actionDistribute.d.ts +34 -34
  72. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +17 -17
  73. package/types/excalidraw/actions/actionElementLink.d.ts +247 -247
  74. package/types/excalidraw/actions/actionElementLock.d.ts +448 -448
  75. package/types/excalidraw/actions/actionEmbeddable.d.ts +222 -222
  76. package/types/excalidraw/actions/actionExport.d.ts +1980 -1980
  77. package/types/excalidraw/actions/actionFinalize.d.ts +674 -470
  78. package/types/excalidraw/actions/actionFlip.d.ts +34 -34
  79. package/types/excalidraw/actions/actionFrame.d.ts +1396 -1396
  80. package/types/excalidraw/actions/actionGroup.d.ts +460 -460
  81. package/types/excalidraw/actions/actionHistory.d.ts +6 -6
  82. package/types/excalidraw/actions/actionLinearEditor.d.ts +722 -722
  83. package/types/excalidraw/actions/actionLink.d.ts +226 -226
  84. package/types/excalidraw/actions/actionMenu.d.ts +658 -658
  85. package/types/excalidraw/actions/actionNavigate.d.ts +436 -436
  86. package/types/excalidraw/actions/actionProperties.d.ts +3329 -3329
  87. package/types/excalidraw/actions/actionSelectAll.d.ts +225 -225
  88. package/types/excalidraw/actions/actionStyles.d.ts +239 -239
  89. package/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -17
  90. package/types/excalidraw/actions/actionToggleGridMode.d.ts +228 -228
  91. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +226 -226
  92. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +219 -219
  93. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -19
  94. package/types/excalidraw/actions/actionToggleStats.d.ts +225 -225
  95. package/types/excalidraw/actions/actionToggleViewMode.d.ts +226 -226
  96. package/types/excalidraw/actions/actionToggleZenMode.d.ts +226 -226
  97. package/types/excalidraw/actions/actionZindex.d.ts +74 -74
  98. package/types/excalidraw/actions/index.d.ts +28 -28
  99. package/types/excalidraw/actions/manager.d.ts +21 -21
  100. package/types/excalidraw/actions/register.d.ts +5 -5
  101. package/types/excalidraw/actions/shortcuts.d.ts +4 -4
  102. package/types/excalidraw/actions/types.d.ts +47 -47
  103. package/types/excalidraw/analytics.d.ts +1 -1
  104. package/types/excalidraw/animated-trail.d.ts +39 -39
  105. package/types/excalidraw/animation-frame-handler.d.ts +16 -16
  106. package/types/excalidraw/appState.d.ts +99 -99
  107. package/types/excalidraw/charts.d.ts +27 -27
  108. package/types/excalidraw/clients.d.ts +14 -14
  109. package/types/excalidraw/clipboard.d.ts +66 -66
  110. package/types/excalidraw/components/Actions.d.ts +35 -35
  111. package/types/excalidraw/components/ActiveConfirmDialog.d.ts +4 -4
  112. package/types/excalidraw/components/App.d.ts +566 -566
  113. package/types/excalidraw/components/Avatar.d.ts +11 -11
  114. package/types/excalidraw/components/BraveMeasureTextError.d.ts +2 -2
  115. package/types/excalidraw/components/Button.d.ts +17 -17
  116. package/types/excalidraw/components/ButtonIcon.d.ts +16 -16
  117. package/types/excalidraw/components/ButtonIconCycle.d.ts +11 -11
  118. package/types/excalidraw/components/ButtonSeparator.d.ts +1 -1
  119. package/types/excalidraw/components/Card.d.ts +6 -6
  120. package/types/excalidraw/components/CheckboxItem.d.ts +8 -8
  121. package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +10 -10
  122. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +23 -23
  123. package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +8 -8
  124. package/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +7 -7
  125. package/types/excalidraw/components/ColorPicker/Picker.d.ts +17 -17
  126. package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -9
  127. package/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +5 -5
  128. package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +8 -8
  129. package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +9 -9
  130. package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +21 -21
  131. package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +20 -20
  132. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +18 -18
  133. package/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -2
  134. package/types/excalidraw/components/CommandPalette/types.d.ts +25 -25
  135. package/types/excalidraw/components/ConfirmDialog.d.ts +10 -10
  136. package/types/excalidraw/components/ContextMenu.d.ts +16 -16
  137. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -23
  138. package/types/excalidraw/components/DarkModeToggle.d.ts +7 -7
  139. package/types/excalidraw/components/DefaultSidebar.d.ts +30 -30
  140. package/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +4 -4
  141. package/types/excalidraw/components/Dialog.d.ts +13 -13
  142. package/types/excalidraw/components/DialogActionButton.d.ts +10 -10
  143. package/types/excalidraw/components/ElementCanvasButtons.d.ts +7 -7
  144. package/types/excalidraw/components/ElementLinkDialog.d.ts +12 -12
  145. package/types/excalidraw/components/ErrorDialog.d.ts +5 -5
  146. package/types/excalidraw/components/ExcalidrawLogo.d.ts +15 -15
  147. package/types/excalidraw/components/EyeDropper.d.ts +27 -27
  148. package/types/excalidraw/components/FilledButton.d.ts +18 -18
  149. package/types/excalidraw/components/FixedSideContainer.d.ts +9 -9
  150. package/types/excalidraw/components/FollowMode/FollowMode.d.ts +10 -10
  151. package/types/excalidraw/components/FontPicker/FontPicker.d.ts +21 -21
  152. package/types/excalidraw/components/FontPicker/FontPickerList.d.ts +26 -26
  153. package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +6 -6
  154. package/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +13 -13
  155. package/types/excalidraw/components/HandButton.d.ts +10 -10
  156. package/types/excalidraw/components/HelpButton.d.ts +7 -7
  157. package/types/excalidraw/components/HelpDialog.d.ts +4 -4
  158. package/types/excalidraw/components/HintViewer.d.ts +10 -10
  159. package/types/excalidraw/components/IconPicker.d.ts +15 -15
  160. package/types/excalidraw/components/ImageExportDialog.d.ts +14 -14
  161. package/types/excalidraw/components/InitializeApp.d.ts +10 -10
  162. package/types/excalidraw/components/InlineIcon.d.ts +3 -3
  163. package/types/excalidraw/components/Island.d.ts +10 -10
  164. package/types/excalidraw/components/JSONExportDialog.d.ts +15 -15
  165. package/types/excalidraw/components/LaserPointerButton.d.ts +10 -10
  166. package/types/excalidraw/components/LayerUI.d.ts +31 -31
  167. package/types/excalidraw/components/LibraryMenu.d.ts +10 -10
  168. package/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +7 -7
  169. package/types/excalidraw/components/LibraryMenuControlButtons.d.ts +9 -9
  170. package/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +17 -17
  171. package/types/excalidraw/components/LibraryMenuItems.d.ts +14 -14
  172. package/types/excalidraw/components/LibraryMenuSection.d.ts +23 -23
  173. package/types/excalidraw/components/LibraryUnit.d.ts +14 -14
  174. package/types/excalidraw/components/LoadingMessage.d.ts +5 -5
  175. package/types/excalidraw/components/LockButton.d.ts +10 -10
  176. package/types/excalidraw/components/MagicButton.d.ts +10 -10
  177. package/types/excalidraw/components/MobileMenu.d.ts +25 -25
  178. package/types/excalidraw/components/Modal.d.ts +14 -14
  179. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -17
  180. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -17
  181. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -22
  182. package/types/excalidraw/components/Paragraph.d.ts +4 -4
  183. package/types/excalidraw/components/PasteChartDialog.d.ts +8 -8
  184. package/types/excalidraw/components/PenModeButton.d.ts +12 -12
  185. package/types/excalidraw/components/Popover.d.ts +15 -15
  186. package/types/excalidraw/components/ProjectName.d.ts +10 -10
  187. package/types/excalidraw/components/PropertiesPopover.d.ts +15 -15
  188. package/types/excalidraw/components/PublishLibrary.d.ts +16 -16
  189. package/types/excalidraw/components/QuickSearch.d.ts +9 -9
  190. package/types/excalidraw/components/RadioGroup.d.ts +13 -13
  191. package/types/excalidraw/components/RadioSelection.d.ts +20 -20
  192. package/types/excalidraw/components/Range.d.ts +8 -8
  193. package/types/excalidraw/components/SVGLayer.d.ts +7 -7
  194. package/types/excalidraw/components/ScrollableList.d.ts +8 -8
  195. package/types/excalidraw/components/SearchMenu.d.ts +5 -5
  196. package/types/excalidraw/components/Section.d.ts +6 -6
  197. package/types/excalidraw/components/ShareableLinkDialog.d.ts +7 -7
  198. package/types/excalidraw/components/Sidebar/Sidebar.d.ts +76 -76
  199. package/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +7 -7
  200. package/types/excalidraw/components/Sidebar/SidebarTab.d.ts +8 -8
  201. package/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +9 -9
  202. package/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +6 -6
  203. package/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +6 -6
  204. package/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +6 -6
  205. package/types/excalidraw/components/Sidebar/common.d.ts +34 -34
  206. package/types/excalidraw/components/Spinner.d.ts +8 -8
  207. package/types/excalidraw/components/Stack.d.ts +15 -15
  208. package/types/excalidraw/components/Stats/Angle.d.ts +11 -11
  209. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +10 -10
  210. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +10 -10
  211. package/types/excalidraw/components/Stats/Collapsible.d.ts +10 -10
  212. package/types/excalidraw/components/Stats/Dimension.d.ts +11 -11
  213. package/types/excalidraw/components/Stats/DragInput.d.ts +34 -34
  214. package/types/excalidraw/components/Stats/FontSize.d.ts +11 -11
  215. package/types/excalidraw/components/Stats/MultiAngle.d.ts +11 -11
  216. package/types/excalidraw/components/Stats/MultiDimension.d.ts +14 -14
  217. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +12 -12
  218. package/types/excalidraw/components/Stats/MultiPosition.d.ts +14 -14
  219. package/types/excalidraw/components/Stats/Position.d.ts +12 -12
  220. package/types/excalidraw/components/Stats/index.d.ts +35 -35
  221. package/types/excalidraw/components/Stats/utils.d.ts +19 -19
  222. package/types/excalidraw/components/Switch.d.ts +9 -9
  223. package/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +8 -8
  224. package/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib.d.ts +10 -10
  225. package/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +29 -29
  226. package/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +9 -9
  227. package/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +7 -7
  228. package/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +17 -17
  229. package/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +4 -4
  230. package/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -1
  231. package/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +7 -7
  232. package/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -8
  233. package/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -6
  234. package/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +11 -11
  235. package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +9 -9
  236. package/types/excalidraw/components/TTDDialog/common.d.ts +32 -32
  237. package/types/excalidraw/components/TextField.d.ts +21 -21
  238. package/types/excalidraw/components/Toast.d.ts +9 -9
  239. package/types/excalidraw/components/ToolButton.d.ts +49 -49
  240. package/types/excalidraw/components/Tooltip.d.ts +18 -18
  241. package/types/excalidraw/components/Trans.d.ts +9 -9
  242. package/types/excalidraw/components/UnlockPopup.d.ts +8 -8
  243. package/types/excalidraw/components/UserList.d.ts +18 -18
  244. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +30 -30
  245. package/types/excalidraw/components/canvases/NewElementCanvas.d.ts +14 -14
  246. package/types/excalidraw/components/canvases/StaticCanvas.d.ts +19 -19
  247. package/types/excalidraw/components/canvases/index.d.ts +3 -3
  248. package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +86 -86
  249. package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +15 -15
  250. package/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -11
  251. package/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +46 -46
  252. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +8 -8
  253. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +17 -17
  254. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -7
  255. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +16 -16
  256. package/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -5
  257. package/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -10
  258. package/types/excalidraw/components/dropdownMenu/common.d.ts +6 -6
  259. package/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -3
  260. package/types/excalidraw/components/footer/Footer.d.ts +12 -12
  261. package/types/excalidraw/components/footer/FooterCenter.d.ts +8 -8
  262. package/types/excalidraw/components/hoc/withInternalFallback.d.ts +4 -4
  263. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -19
  264. package/types/excalidraw/components/hyperlink/helpers.d.ts +10 -10
  265. package/types/excalidraw/components/icons.d.ts +227 -227
  266. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -9
  267. package/types/excalidraw/components/main-menu/DefaultItems.d.ts +64 -64
  268. package/types/excalidraw/components/main-menu/MainMenu.d.ts +83 -83
  269. package/types/excalidraw/components/shapes.d.ts +62 -62
  270. package/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +60 -60
  271. package/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -19
  272. package/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +86 -86
  273. package/types/excalidraw/context/tunnels.d.ts +21 -21
  274. package/types/excalidraw/context/ui-appState.d.ts +4 -4
  275. package/types/excalidraw/cursor.d.ts +6 -6
  276. package/types/excalidraw/data/EditorLocalStorage.d.ts +8 -8
  277. package/types/excalidraw/data/ai/types.d.ts +242 -242
  278. package/types/excalidraw/data/blob.d.ts +53 -53
  279. package/types/excalidraw/data/encode.d.ts +55 -55
  280. package/types/excalidraw/data/encryption.d.ts +9 -9
  281. package/types/excalidraw/data/filesystem.d.ts +21 -21
  282. package/types/excalidraw/data/image.d.ts +9 -9
  283. package/types/excalidraw/data/index.d.ts +22 -22
  284. package/types/excalidraw/data/json.d.ts +16 -16
  285. package/types/excalidraw/data/library.d.ts +112 -112
  286. package/types/excalidraw/data/reconcile.d.ts +6 -6
  287. package/types/excalidraw/data/resave.d.ts +5 -5
  288. package/types/excalidraw/data/restore.d.ts +21 -21
  289. package/types/excalidraw/data/transform.d.ts +81 -81
  290. package/types/excalidraw/data/types.d.ts +45 -45
  291. package/types/excalidraw/deburr.d.ts +1 -1
  292. package/types/excalidraw/dist/excalidraw.development.d.ts +2 -2
  293. package/types/excalidraw/dist/excalidraw.production.min.d.ts +3 -3
  294. package/types/excalidraw/editor-jotai.d.ts +56 -56
  295. package/types/excalidraw/entry.d.ts +1 -1
  296. package/types/excalidraw/env.d.cts +1 -1
  297. package/types/excalidraw/env.d.ts +1 -1
  298. package/types/excalidraw/eraser/index.d.ts +14 -14
  299. package/types/excalidraw/errors.d.ts +29 -29
  300. package/types/excalidraw/fonts/Cascadia/index.d.ts +2 -2
  301. package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -2
  302. package/types/excalidraw/fonts/Emoji/index.d.ts +2 -2
  303. package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +29 -29
  304. package/types/excalidraw/fonts/Excalifont/index.d.ts +2 -2
  305. package/types/excalidraw/fonts/Fonts.d.ts +90 -90
  306. package/types/excalidraw/fonts/Helvetica/index.d.ts +2 -2
  307. package/types/excalidraw/fonts/Liberation/index.d.ts +2 -2
  308. package/types/excalidraw/fonts/Lilita/index.d.ts +2 -2
  309. package/types/excalidraw/fonts/Nunito/index.d.ts +2 -2
  310. package/types/excalidraw/fonts/Virgil/index.d.ts +2 -2
  311. package/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -8
  312. package/types/excalidraw/fonts/index.d.ts +1 -1
  313. package/types/excalidraw/gesture.d.ts +6 -6
  314. package/types/excalidraw/history.d.ts +32 -32
  315. package/types/excalidraw/hooks/useCallbackRefState.d.ts +1 -1
  316. package/types/excalidraw/hooks/useCopiedIndicator.d.ts +5 -5
  317. package/types/excalidraw/hooks/useCreatePortalContainer.d.ts +7 -7
  318. package/types/excalidraw/hooks/useEmitter.d.ts +2 -2
  319. package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +11 -11
  320. package/types/excalidraw/hooks/useOutsideClick.d.ts +19 -19
  321. package/types/excalidraw/hooks/useScrollPosition.d.ts +1 -1
  322. package/types/excalidraw/hooks/useStable.d.ts +1 -1
  323. package/types/excalidraw/hooks/useStableCallback.d.ts +4 -4
  324. package/types/excalidraw/hooks/useTransition.d.ts +2 -2
  325. package/types/excalidraw/i18n.d.ts +24 -24
  326. package/types/excalidraw/index-node.d.ts +1 -1
  327. package/types/excalidraw/index.d.ts +59 -59
  328. package/types/excalidraw/laser-trails.d.ts +20 -20
  329. package/types/excalidraw/lasso/index.d.ts +16 -16
  330. package/types/excalidraw/lasso/utils.d.ts +12 -12
  331. package/types/excalidraw/main.d.ts +2 -2
  332. package/types/excalidraw/mermaid.d.ts +2 -2
  333. package/types/excalidraw/obsidianUtils.d.ts +37 -37
  334. package/types/excalidraw/polyfill.d.ts +2 -2
  335. package/types/excalidraw/publicPath.d.ts +1 -1
  336. package/types/excalidraw/reactUtils.d.ts +14 -14
  337. package/types/excalidraw/renderer/helpers.d.ts +18 -18
  338. package/types/excalidraw/renderer/interactiveScene.d.ts +20 -20
  339. package/types/excalidraw/renderer/renderNewElementScene.d.ts +7 -7
  340. package/types/excalidraw/renderer/renderSnaps.d.ts +2 -2
  341. package/types/excalidraw/renderer/roundRect.d.ts +11 -11
  342. package/types/excalidraw/renderer/staticScene.d.ts +11 -11
  343. package/types/excalidraw/renderer/staticSvgScene.d.ts +5 -5
  344. package/types/excalidraw/scene/Renderer.d.ts +28 -28
  345. package/types/excalidraw/scene/export.d.ts +37 -37
  346. package/types/excalidraw/scene/index.d.ts +4 -4
  347. package/types/excalidraw/scene/normalize.d.ts +4 -4
  348. package/types/excalidraw/scene/scroll.d.ts +23 -23
  349. package/types/excalidraw/scene/scrollbars.d.ts +11 -11
  350. package/types/excalidraw/scene/types.d.ts +122 -122
  351. package/types/excalidraw/scene/zoom.d.ts +12 -12
  352. package/types/excalidraw/snapping.d.ts +111 -111
  353. package/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -45
  354. package/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -13
  355. package/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -2
  356. package/types/excalidraw/subset/subset-main.d.ts +12 -12
  357. package/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -32
  358. package/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -15
  359. package/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -31
  360. package/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -14
  361. package/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -2
  362. package/types/excalidraw/types.d.ts +780 -780
  363. package/types/excalidraw/visualdebug.d.ts +41 -41
  364. package/types/excalidraw/webpack.dev.config.d.ts +114 -114
  365. package/types/excalidraw/webpack.prod.config.d.ts +128 -128
  366. package/types/excalidraw/workers.d.ts +36 -36
  367. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +24 -24
  368. package/types/math/src/angle.d.ts +17 -17
  369. package/types/math/src/curve.d.ts +42 -42
  370. package/types/math/src/ellipse.d.ts +44 -44
  371. package/types/math/src/index.d.ts +12 -12
  372. package/types/math/src/line.d.ts +17 -17
  373. package/types/math/src/point.d.ts +122 -122
  374. package/types/math/src/polygon.d.ts +6 -6
  375. package/types/math/src/range.d.ts +44 -44
  376. package/types/math/src/rectangle.d.ts +3 -3
  377. package/types/math/src/segment.d.ts +39 -39
  378. package/types/math/src/triangle.d.ts +11 -11
  379. package/types/math/src/types.d.ts +106 -106
  380. package/types/math/src/utils.d.ts +7 -7
  381. package/types/math/src/vector.d.ts +92 -92
  382. package/types/utils/src/bbox.d.ts +9 -9
  383. package/types/utils/src/collision.d.ts +8 -8
  384. package/types/utils/src/export.d.ts +35 -35
  385. package/types/utils/src/index.d.ts +4 -4
  386. package/types/utils/src/shape.d.ts +58 -58
  387. package/types/utils/src/withinBounds.d.ts +19 -19
@@ -1,780 +1,780 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom } from "@excalidraw/common";
2
- import type { SuggestedBinding } from "@excalidraw/element";
3
- import type { LinearElementEditor } from "@excalidraw/element";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element";
5
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
6
- import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
- import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
8
- import type { Action } from "./actions/types";
9
- import type { Spreadsheet } from "./charts";
10
- import type { ClipboardData } from "./clipboard";
11
- import type App from "./components/App";
12
- import type Library from "./data/library";
13
- import type { FileSystemHandle } from "./data/filesystem";
14
- import type { ContextMenuItems } from "./components/ContextMenu";
15
- import type { SnapLine } from "./snapping";
16
- import type { ImportedDataState } from "./data/types";
17
- import type { Language } from "./i18n";
18
- import type { isOverScrollBars } from "./scene/scrollbars";
19
- import type React from "react";
20
- import type { JSX } from "react";
21
- export type SocketId = string & {
22
- _brand: "SocketId";
23
- };
24
- export type Collaborator = Readonly<{
25
- pointer?: CollaboratorPointer;
26
- button?: "up" | "down";
27
- selectedElementIds?: AppState["selectedElementIds"];
28
- username?: string | null;
29
- userState?: UserIdleState;
30
- color?: {
31
- background: string;
32
- stroke: string;
33
- };
34
- avatarUrl?: string;
35
- id?: string;
36
- socketId?: SocketId;
37
- isCurrentUser?: boolean;
38
- isInCall?: boolean;
39
- isSpeaking?: boolean;
40
- isMuted?: boolean;
41
- }>;
42
- export type CollaboratorPointer = {
43
- x: number;
44
- y: number;
45
- tool: "pointer" | "laser";
46
- /**
47
- * Whether to render cursor + username. Useful when you only want to render
48
- * laser trail.
49
- *
50
- * @default true
51
- */
52
- renderCursor?: boolean;
53
- /**
54
- * Explicit laser color.
55
- *
56
- * @default string collaborator's cursor color
57
- */
58
- laserColor?: string;
59
- };
60
- export type DataURL = string & {
61
- _brand: "DataURL";
62
- };
63
- export type BinaryFileData = {
64
- mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
65
- id: FileId;
66
- dataURL: DataURL;
67
- /**
68
- * Epoch timestamp in milliseconds
69
- */
70
- created: number;
71
- /**
72
- * Indicates when the file was last retrieved from storage to be loaded
73
- * onto the scene. We use this flag to determine whether to delete unused
74
- * files from storage.
75
- *
76
- * Epoch timestamp in milliseconds.
77
- */
78
- lastRetrieved?: number;
79
- /**
80
- * indicates the version of the file. This can be used to determine whether
81
- * the file dataURL has changed e.g. as part of restore due to schema update.
82
- */
83
- version?: number;
84
- };
85
- export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
86
- export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
87
- export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser" | "mermaid";
88
- export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
89
- export type ActiveTool = {
90
- type: ToolType;
91
- customType: null;
92
- } | {
93
- type: "custom";
94
- customType: string;
95
- };
96
- export type SidebarName = string;
97
- export type SidebarTabName = string;
98
- export type UserToFollow = {
99
- socketId: SocketId;
100
- username: string;
101
- };
102
- type _CommonCanvasAppState = {
103
- zoom: AppState["zoom"];
104
- scrollX: AppState["scrollX"];
105
- scrollY: AppState["scrollY"];
106
- width: AppState["width"];
107
- height: AppState["height"];
108
- viewModeEnabled: AppState["viewModeEnabled"];
109
- openDialog: AppState["openDialog"];
110
- editingGroupId: AppState["editingGroupId"];
111
- selectedElementIds: AppState["selectedElementIds"];
112
- frameToHighlight: AppState["frameToHighlight"];
113
- offsetLeft: AppState["offsetLeft"];
114
- offsetTop: AppState["offsetTop"];
115
- theme: AppState["theme"];
116
- pendingImageElementId: AppState["pendingImageElementId"];
117
- };
118
- export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
119
- shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
120
- /** null indicates transparent bg */
121
- viewBackgroundColor: AppState["viewBackgroundColor"] | null;
122
- exportScale: AppState["exportScale"];
123
- selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
124
- gridSize: AppState["gridSize"];
125
- gridStep: AppState["gridStep"];
126
- frameRendering: AppState["frameRendering"];
127
- linkOpacity: AppState["linkOpacity"];
128
- gridColor: AppState["gridColor"];
129
- gridDirection: AppState["gridDirection"];
130
- frameColor: AppState["frameColor"];
131
- currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
132
- hoveredElementIds: AppState["hoveredElementIds"];
133
- croppingElementId: AppState["croppingElementId"];
134
- }>;
135
- export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
136
- activeEmbeddable: AppState["activeEmbeddable"];
137
- editingLinearElement: AppState["editingLinearElement"];
138
- selectionElement: AppState["selectionElement"];
139
- selectedGroupIds: AppState["selectedGroupIds"];
140
- selectedLinearElement: AppState["selectedLinearElement"];
141
- multiElement: AppState["multiElement"];
142
- isBindingEnabled: AppState["isBindingEnabled"];
143
- suggestedBindings: AppState["suggestedBindings"];
144
- isRotating: AppState["isRotating"];
145
- elementsToHighlight: AppState["elementsToHighlight"];
146
- collaborators: AppState["collaborators"];
147
- snapLines: AppState["snapLines"];
148
- zenModeEnabled: AppState["zenModeEnabled"];
149
- editingTextElement: AppState["editingTextElement"];
150
- gridColor: AppState["gridColor"];
151
- gridDirection: AppState["gridDirection"];
152
- highlightSearchResult: AppState["highlightSearchResult"];
153
- isCropping: AppState["isCropping"];
154
- croppingElementId: AppState["croppingElementId"];
155
- searchMatches: AppState["searchMatches"];
156
- activeLockedId: AppState["activeLockedId"];
157
- }>;
158
- export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
159
- export type ObservedStandaloneAppState = {
160
- name: AppState["name"];
161
- viewBackgroundColor: AppState["viewBackgroundColor"];
162
- };
163
- export type ObservedElementsAppState = {
164
- editingGroupId: AppState["editingGroupId"];
165
- selectedElementIds: AppState["selectedElementIds"];
166
- selectedGroupIds: AppState["selectedGroupIds"];
167
- editingLinearElementId: LinearElementEditor["elementId"] | null;
168
- selectedLinearElementId: LinearElementEditor["elementId"] | null;
169
- croppingElementId: AppState["croppingElementId"];
170
- lockedMultiSelections: AppState["lockedMultiSelections"];
171
- activeLockedId: AppState["activeLockedId"];
172
- };
173
- export interface AppState {
174
- contextMenu: {
175
- items: ContextMenuItems;
176
- top: number;
177
- left: number;
178
- } | null;
179
- showWelcomeScreen: boolean;
180
- isLoading: boolean;
181
- errorMessage: React.ReactNode;
182
- activeEmbeddable: {
183
- element: NonDeletedExcalidrawElement;
184
- state: "hover" | "active";
185
- } | null;
186
- /**
187
- * for a newly created element
188
- * - set on pointer down, updated during pointer move, used on pointer up
189
- */
190
- newElement: NonDeleted<ExcalidrawNonSelectionElement> | null;
191
- /**
192
- * for a single element that's being resized
193
- * - set on pointer down when it's selected and the active tool is selection
194
- */
195
- resizingElement: NonDeletedExcalidrawElement | null;
196
- /**
197
- * multiElement is for multi-point linear element that's created by clicking as opposed to dragging
198
- * - when set and present, the editor will handle linear element creation logic accordingly
199
- */
200
- multiElement: NonDeleted<ExcalidrawLinearElement> | null;
201
- /**
202
- * decoupled from newElement, dragging selection only creates selectionElement
203
- * - set on pointer down, updated during pointer move
204
- */
205
- selectionElement: NonDeletedExcalidrawElement | null;
206
- isBindingEnabled: boolean;
207
- startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
208
- suggestedBindings: SuggestedBinding[];
209
- frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
210
- frameRendering: {
211
- enabled: boolean;
212
- name: boolean;
213
- outline: boolean;
214
- clip: boolean;
215
- };
216
- editingFrame: string | null;
217
- elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
218
- /**
219
- * set when a new text is created or when an existing text is being edited
220
- */
221
- editingTextElement: NonDeletedExcalidrawElement | null;
222
- editingLinearElement: LinearElementEditor | null;
223
- activeTool: {
224
- /**
225
- * indicates a previous tool we should revert back to if we deselect the
226
- * currently active tool. At the moment applies to `eraser` and `hand` tool.
227
- */
228
- lastActiveTool: ActiveTool | null;
229
- locked: boolean;
230
- fromSelection: boolean;
231
- } & ActiveTool;
232
- penMode: boolean;
233
- penDetected: boolean;
234
- exportBackground: boolean;
235
- exportEmbedScene: boolean;
236
- exportWithDarkMode: boolean;
237
- exportScale: number;
238
- currentItemStrokeColor: string;
239
- currentItemBackgroundColor: string;
240
- currentItemFillStyle: ExcalidrawElement["fillStyle"];
241
- currentItemStrokeWidth: number;
242
- currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
243
- currentItemRoughness: number;
244
- currentItemOpacity: number;
245
- currentItemFontFamily: FontFamilyValues;
246
- currentItemFontSize: number;
247
- currentItemTextAlign: TextAlign;
248
- currentItemStartArrowhead: Arrowhead | null;
249
- currentItemEndArrowhead: Arrowhead | null;
250
- currentHoveredFontFamily: FontFamilyValues | null;
251
- currentItemRoundness: StrokeRoundness;
252
- currentItemArrowType: "sharp" | "round" | "elbow";
253
- viewBackgroundColor: string;
254
- scrollX: number;
255
- scrollY: number;
256
- cursorButton: "up" | "down";
257
- scrolledOutside: boolean;
258
- name: string | null;
259
- isResizing: boolean;
260
- isRotating: boolean;
261
- zoom: Zoom;
262
- openMenu: "canvas" | "shape" | null;
263
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
264
- openSidebar: {
265
- name: SidebarName;
266
- tab?: SidebarTabName;
267
- } | null;
268
- openDialog: null | {
269
- name: "imageExport" | "help" | "jsonExport";
270
- } | {
271
- name: "ttd";
272
- tab: "text-to-diagram" | "mermaid";
273
- } | {
274
- name: "commandPalette";
275
- } | {
276
- name: "elementLinkSelector";
277
- sourceElementId: ExcalidrawElement["id"];
278
- };
279
- /**
280
- * Reflects user preference for whether the default sidebar should be docked.
281
- *
282
- * NOTE this is only a user preference and does not reflect the actual docked
283
- * state of the sidebar, because the host apps can override this through
284
- * a DefaultSidebar prop, which is not reflected back to the appState.
285
- */
286
- defaultSidebarDockedPreference: boolean;
287
- lastPointerDownWith: PointerType;
288
- selectedElementIds: Readonly<{
289
- [id: string]: true;
290
- }>;
291
- hoveredElementIds: Readonly<{
292
- [id: string]: true;
293
- }>;
294
- previousSelectedElementIds: {
295
- [id: string]: true;
296
- };
297
- selectedElementsAreBeingDragged: boolean;
298
- shouldCacheIgnoreZoom: boolean;
299
- toast: {
300
- message: string;
301
- closable?: boolean;
302
- duration?: number;
303
- } | null;
304
- zenModeEnabled: boolean;
305
- theme: Theme;
306
- /** grid cell px size */
307
- gridSize: number;
308
- gridStep: number;
309
- gridModeEnabled: boolean;
310
- viewModeEnabled: boolean;
311
- /** top-most selected groups (i.e. does not include nested groups) */
312
- selectedGroupIds: {
313
- [groupId: string]: boolean;
314
- };
315
- /** group being edited when you drill down to its constituent element
316
- (e.g. when you double-click on a group's element) */
317
- editingGroupId: GroupId | null;
318
- width: number;
319
- height: number;
320
- offsetTop: number;
321
- offsetLeft: number;
322
- fileHandle: FileSystemHandle | null;
323
- collaborators: Map<SocketId, Collaborator>;
324
- stats: {
325
- open: boolean;
326
- /** bitmap. Use `STATS_PANELS` bit values */
327
- panels: number;
328
- };
329
- currentChartType: ChartType;
330
- pasteDialog: {
331
- shown: false;
332
- data: null;
333
- } | {
334
- shown: true;
335
- data: Spreadsheet;
336
- };
337
- /** imageElement waiting to be placed on canvas */
338
- pendingImageElementId: ExcalidrawImageElement["id"] | null;
339
- showHyperlinkPopup: false | "info" | "editor";
340
- linkOpacity: number;
341
- trayModeEnabled: boolean;
342
- colorPalette?: {
343
- canvasBackground: ColorPaletteCustom;
344
- elementBackground: ColorPaletteCustom;
345
- elementStroke: ColorPaletteCustom;
346
- topPicks: {
347
- canvasBackground: [string, string, string, string, string];
348
- elementStroke: [string, string, string, string, string];
349
- elementBackground: [string, string, string, string, string];
350
- };
351
- };
352
- allowWheelZoom?: boolean;
353
- allowPinchZoom?: boolean;
354
- pinnedScripts?: string[];
355
- customPens?: any[];
356
- currentStrokeOptions?: any;
357
- resetCustomPen?: any;
358
- gridColor: {
359
- Bold: string;
360
- Regular: string;
361
- };
362
- gridDirection: {
363
- horizontal: boolean;
364
- vertical: boolean;
365
- };
366
- highlightSearchResult: boolean;
367
- dynamicStyle: {
368
- [x: string]: string;
369
- };
370
- frameColor: {
371
- stroke: string;
372
- fill: string;
373
- nameColor: string;
374
- };
375
- invertBindingBehaviour: boolean;
376
- selectedLinearElement: LinearElementEditor | null;
377
- snapLines: readonly SnapLine[];
378
- originSnapOffset: {
379
- x: number;
380
- y: number;
381
- } | null;
382
- objectsSnapModeEnabled: boolean;
383
- /** the user's socket id & username who is being followed on the canvas */
384
- userToFollow: UserToFollow | null;
385
- /** the socket ids of the users following the current user */
386
- followedBy: Set<SocketId>;
387
- /** image cropping */
388
- isCropping: boolean;
389
- croppingElementId: ExcalidrawElement["id"] | null;
390
- /** null if no search matches found / search closed */
391
- searchMatches: Readonly<{
392
- focusedId: ExcalidrawElement["id"] | null;
393
- matches: readonly SearchMatch[];
394
- }> | null;
395
- /** the locked element/group that's active and shows unlock popup */
396
- activeLockedId: string | null;
397
- lockedMultiSelections: {
398
- [groupId: string]: true;
399
- };
400
- }
401
- export type SearchMatch = {
402
- id: string;
403
- focus: boolean;
404
- matchedLines: {
405
- offsetX: number;
406
- offsetY: number;
407
- width: number;
408
- height: number;
409
- showOnCanvas: boolean;
410
- }[];
411
- };
412
- export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
413
- export type NormalizedZoomValue = number & {
414
- _brand: "normalizedZoom";
415
- };
416
- export type Zoom = Readonly<{
417
- value: NormalizedZoomValue;
418
- }>;
419
- export type PointerCoords = Readonly<{
420
- x: number;
421
- y: number;
422
- }>;
423
- export type Gesture = {
424
- pointers: Map<number, PointerCoords>;
425
- lastCenter: {
426
- x: number;
427
- y: number;
428
- } | null;
429
- initialDistance: number | null;
430
- initialScale: number | null;
431
- };
432
- export declare class GestureEvent extends UIEvent {
433
- readonly rotation: number;
434
- readonly scale: number;
435
- }
436
- /** @deprecated legacy: do not use outside of migration paths */
437
- export type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
438
- /** @deprecated legacy: do not use outside of migration paths */
439
- type LibraryItems_v1 = readonly LibraryItem_v1[];
440
- /** v2 library item */
441
- export type LibraryItem = {
442
- id: string;
443
- status: "published" | "unpublished";
444
- elements: readonly NonDeleted<ExcalidrawElement>[];
445
- /** timestamp in epoch (ms) */
446
- created: number;
447
- name?: string;
448
- error?: string;
449
- };
450
- export type LibraryItems = readonly LibraryItem[];
451
- export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
452
- export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePromise<LibraryItems_anyVersion | Blob>) | MaybePromise<LibraryItems_anyVersion | Blob>;
453
- export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
454
- libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
455
- }>;
456
- export type OnUserFollowedPayload = {
457
- userToFollow: UserToFollow;
458
- action: "FOLLOW" | "UNFOLLOW";
459
- };
460
- export interface ExcalidrawProps {
461
- onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
462
- onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
463
- initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
464
- excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
465
- isCollaborating?: boolean;
466
- onPointerUpdate?: (payload: {
467
- pointer: {
468
- x: number;
469
- y: number;
470
- tool: "pointer" | "laser";
471
- };
472
- button: "down" | "up";
473
- pointersMap: Gesture["pointers"];
474
- }) => void;
475
- onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
476
- onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
477
- /**
478
- * Called when element(s) are duplicated so you can listen or modify as
479
- * needed.
480
- *
481
- * Called when duplicating via mouse-drag, keyboard, paste, library insert
482
- * etc.
483
- *
484
- * Returned elements will be used in place of the next elements
485
- * (you should return all elements, including deleted, and not mutate
486
- * the element if changes are made)
487
- */
488
- onDuplicate?: (nextElements: readonly ExcalidrawElement[],
489
- /** excludes the duplicated elements */
490
- prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
491
- renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
492
- langCode?: Language["code"];
493
- viewModeEnabled?: boolean;
494
- zenModeEnabled?: boolean;
495
- gridModeEnabled?: boolean;
496
- objectsSnapModeEnabled?: boolean;
497
- libraryReturnUrl?: string;
498
- initState?: AppState;
499
- theme?: Theme;
500
- name?: string;
501
- renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
502
- UIOptions?: Partial<UIOptions>;
503
- detectScroll?: boolean;
504
- handleKeyboardGlobally?: boolean;
505
- onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
506
- autoFocus?: boolean;
507
- onBeforeTextEdit?: (textElement: ExcalidrawTextElement, isExistingElement: boolean) => string;
508
- onBeforeTextSubmit?: (textElement: ExcalidrawTextElement, nextText: string, //wrapped
509
- nextOriginalText: string, isDeleted: boolean) => {
510
- updatedNextOriginalText: string;
511
- nextLink: string;
512
- };
513
- generateIdForFile?: (file: File) => string | Promise<string>;
514
- onThemeChange?: (newTheme: string) => void;
515
- onViewModeChange?: (isViewModeEnabled: boolean) => void;
516
- generateLinkForSelection?: (id: string, type: "element" | "group") => string;
517
- onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
518
- nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
519
- }>) => void;
520
- onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
521
- onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
522
- onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
523
- onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
524
- onUserFollow?: (payload: OnUserFollowedPayload) => void;
525
- children?: React.ReactNode;
526
- validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
527
- renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
528
- renderWebview?: boolean;
529
- renderEmbeddableMenu?: (appState: AppState) => JSX.Element | null;
530
- renderMermaid?: boolean;
531
- onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
532
- aiEnabled?: boolean;
533
- showDeprecatedFonts?: boolean;
534
- insertLinkAction?: (linkVal: string) => void;
535
- renderScrollbars?: boolean;
536
- }
537
- export type SceneData = {
538
- elements?: ImportedDataState["elements"];
539
- appState?: ImportedDataState["appState"];
540
- collaborators?: Map<SocketId, Collaborator>;
541
- captureUpdate?: CaptureUpdateActionType;
542
- };
543
- export type ExportOpts = {
544
- saveFileToDisk?: boolean;
545
- onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
546
- renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
547
- };
548
- export type CanvasActions = Partial<{
549
- changeViewBackgroundColor: boolean;
550
- clearCanvas: boolean;
551
- export: false | ExportOpts;
552
- loadScene: boolean;
553
- saveToActiveFile: boolean;
554
- toggleTheme: boolean | null;
555
- saveAsImage: boolean;
556
- }>;
557
- export type UIOptions = Partial<{
558
- dockedSidebarBreakpoint: number;
559
- canvasActions: CanvasActions;
560
- tools: {
561
- image: boolean;
562
- };
563
- /** @deprecated does nothing. Will be removed in 0.15 */
564
- welcomeScreen?: boolean;
565
- }>;
566
- export type AppProps = Merge<ExcalidrawProps, {
567
- UIOptions: Merge<UIOptions, {
568
- canvasActions: Required<CanvasActions> & {
569
- export: ExportOpts;
570
- };
571
- }>;
572
- detectScroll: boolean;
573
- handleKeyboardGlobally: boolean;
574
- isCollaborating: boolean;
575
- children?: React.ReactNode;
576
- aiEnabled: boolean;
577
- }>;
578
- /** A subset of App class properties that we need to use elsewhere
579
- * in the app, eg Manager. Factored out into a separate type to keep DRY. */
580
- export type AppClassProperties = {
581
- props: AppProps;
582
- state: AppState;
583
- interactiveCanvas: HTMLCanvasElement | null;
584
- /** static canvas */
585
- canvas: HTMLCanvasElement;
586
- focusContainer(): void;
587
- library: Library;
588
- imageCache: Map<FileId, {
589
- image: HTMLImageElement | Promise<HTMLImageElement>;
590
- mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
591
- }>;
592
- files: BinaryFiles;
593
- device: App["device"];
594
- scene: App["scene"];
595
- syncActionResult: App["syncActionResult"];
596
- fonts: App["fonts"];
597
- pasteFromClipboard: App["pasteFromClipboard"];
598
- id: App["id"];
599
- onInsertElements: App["onInsertElements"];
600
- onExportImage: App["onExportImage"];
601
- lastViewportPosition: App["lastViewportPosition"];
602
- scrollToContent: App["scrollToContent"];
603
- addFiles: App["addFiles"];
604
- addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
605
- setSelection: App["setSelection"];
606
- togglePenMode: App["togglePenMode"];
607
- toggleLock: App["toggleLock"];
608
- setActiveTool: App["setActiveTool"];
609
- setOpenDialog: App["setOpenDialog"];
610
- insertEmbeddableElement: App["insertEmbeddableElement"];
611
- onMagicframeToolSelect: App["onMagicframeToolSelect"];
612
- getName: App["getName"];
613
- dismissLinearEditor: App["dismissLinearEditor"];
614
- flowChartCreator: App["flowChartCreator"];
615
- getEffectiveGridSize: App["getEffectiveGridSize"];
616
- setPlugins: App["setPlugins"];
617
- plugins: App["plugins"];
618
- getEditorUIOffsets: App["getEditorUIOffsets"];
619
- visibleElements: App["visibleElements"];
620
- excalidrawContainerValue: App["excalidrawContainerValue"];
621
- onPointerUpEmitter: App["onPointerUpEmitter"];
622
- updateEditorAtom: App["updateEditorAtom"];
623
- };
624
- export type PointerDownState = Readonly<{
625
- origin: Readonly<{
626
- x: number;
627
- y: number;
628
- }>;
629
- originInGrid: Readonly<{
630
- x: number;
631
- y: number;
632
- }>;
633
- scrollbars: ReturnType<typeof isOverScrollBars>;
634
- lastCoords: {
635
- x: number;
636
- y: number;
637
- };
638
- originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
639
- resize: {
640
- handleType: MaybeTransformHandleType;
641
- isResizing: boolean;
642
- offset: {
643
- x: number;
644
- y: number;
645
- };
646
- arrowDirection: "origin" | "end";
647
- center: {
648
- x: number;
649
- y: number;
650
- };
651
- };
652
- hit: {
653
- element: NonDeleted<ExcalidrawElement> | null;
654
- allHitElements: NonDeleted<ExcalidrawElement>[];
655
- wasAddedToSelection: boolean;
656
- hasBeenDuplicated: boolean;
657
- hasHitCommonBoundingBoxOfSelectedElements: boolean;
658
- };
659
- withCmdOrCtrl: boolean;
660
- drag: {
661
- hasOccurred: boolean;
662
- offset: {
663
- x: number;
664
- y: number;
665
- } | null;
666
- origin: {
667
- x: number;
668
- y: number;
669
- };
670
- };
671
- eventListeners: {
672
- onMove: null | ReturnType<typeof throttleRAF>;
673
- onUp: null | ((event: PointerEvent) => void);
674
- onKeyDown: null | ((event: KeyboardEvent) => void);
675
- onKeyUp: null | ((event: KeyboardEvent) => void);
676
- };
677
- boxSelection: {
678
- hasOccurred: boolean;
679
- };
680
- }>;
681
- export type UnsubscribeCallback = () => void;
682
- export interface ExcalidrawImperativeAPI {
683
- updateScene: InstanceType<typeof App>["updateScene"];
684
- mutateElement: InstanceType<typeof App>["mutateElement"];
685
- updateLibrary: InstanceType<typeof Library>["updateLibrary"];
686
- resetScene: InstanceType<typeof App>["resetScene"];
687
- getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
688
- history: {
689
- clear: InstanceType<typeof App>["resetHistory"];
690
- };
691
- setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
692
- zoomToFit: InstanceType<typeof App>["zoomToFit"];
693
- getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
694
- startLineEditor: InstanceType<typeof App>["startLineEditor"];
695
- getSceneElements: InstanceType<typeof App>["getSceneElements"];
696
- getAppState: () => InstanceType<typeof App>["state"];
697
- getFiles: () => InstanceType<typeof App>["files"];
698
- getName: InstanceType<typeof App>["getName"];
699
- scrollToContent: InstanceType<typeof App>["scrollToContent"];
700
- registerAction: (action: Action) => void;
701
- refresh: InstanceType<typeof App>["refresh"];
702
- setToast: InstanceType<typeof App>["setToast"];
703
- addFiles: (data: BinaryFileData[]) => void;
704
- updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
705
- id: string;
706
- selectElements: (elements: readonly ExcalidrawElement[], highlightSearchResult?: boolean) => void;
707
- sendBackward: (elements: readonly ExcalidrawElement[]) => void;
708
- bringForward: (elements: readonly ExcalidrawElement[]) => void;
709
- sendToBack: (elements: readonly ExcalidrawElement[]) => void;
710
- bringToFront: (elements: readonly ExcalidrawElement[]) => void;
711
- setMobileModeAllowed: (allow: boolean) => void;
712
- setActiveTool: InstanceType<typeof App>["setActiveTool"];
713
- setCursor: InstanceType<typeof App>["setCursor"];
714
- resetCursor: InstanceType<typeof App>["resetCursor"];
715
- toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
716
- getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
717
- /**
718
- * Disables rendering of frames (including element clipping), but currently
719
- * the frames are still interactive in edit mode. As such, this API should be
720
- * used in conjunction with view mode (props.viewModeEnabled).
721
- */
722
- updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
723
- onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
724
- onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
725
- onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
726
- onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
727
- onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
728
- onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
729
- }
730
- export type Device = Readonly<{
731
- viewport: {
732
- isMobile: boolean;
733
- isLandscape: boolean;
734
- };
735
- editor: {
736
- isMobile: boolean;
737
- canFitSidebar: boolean;
738
- };
739
- isTouchScreen: boolean;
740
- }>;
741
- export type FrameNameBounds = {
742
- x: number;
743
- y: number;
744
- width: number;
745
- height: number;
746
- angle: number;
747
- };
748
- export type FrameNameBoundsCache = {
749
- get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
750
- _cache: Map<string, FrameNameBounds & {
751
- zoom: AppState["zoom"]["value"];
752
- versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
753
- }>;
754
- };
755
- export type KeyboardModifiersObject = {
756
- ctrlKey: boolean;
757
- shiftKey: boolean;
758
- altKey: boolean;
759
- metaKey: boolean;
760
- };
761
- export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
762
- export type JSONValue = string | number | boolean | null | object;
763
- export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
764
- export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
765
- export type PendingExcalidrawElements = ExcalidrawElement[];
766
- /** Runtime gridSize value. Null indicates disabled grid. */
767
- export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
768
- export type GenerateDiagramToCode = (props: {
769
- frame: ExcalidrawMagicFrameElement;
770
- children: readonly ExcalidrawElement[];
771
- }) => MaybePromise<{
772
- html: string;
773
- }>;
774
- export type Offsets = Partial<{
775
- top: number;
776
- right: number;
777
- bottom: number;
778
- left: number;
779
- }>;
780
- export {};
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom } from "@excalidraw/common";
2
+ import type { SuggestedBinding } from "@excalidraw/element";
3
+ import type { LinearElementEditor } from "@excalidraw/element";
4
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
5
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
6
+ import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
8
+ import type { Action } from "./actions/types";
9
+ import type { Spreadsheet } from "./charts";
10
+ import type { ClipboardData } from "./clipboard";
11
+ import type App from "./components/App";
12
+ import type Library from "./data/library";
13
+ import type { FileSystemHandle } from "./data/filesystem";
14
+ import type { ContextMenuItems } from "./components/ContextMenu";
15
+ import type { SnapLine } from "./snapping";
16
+ import type { ImportedDataState } from "./data/types";
17
+ import type { Language } from "./i18n";
18
+ import type { isOverScrollBars } from "./scene/scrollbars";
19
+ import type React from "react";
20
+ import type { JSX } from "react";
21
+ export type SocketId = string & {
22
+ _brand: "SocketId";
23
+ };
24
+ export type Collaborator = Readonly<{
25
+ pointer?: CollaboratorPointer;
26
+ button?: "up" | "down";
27
+ selectedElementIds?: AppState["selectedElementIds"];
28
+ username?: string | null;
29
+ userState?: UserIdleState;
30
+ color?: {
31
+ background: string;
32
+ stroke: string;
33
+ };
34
+ avatarUrl?: string;
35
+ id?: string;
36
+ socketId?: SocketId;
37
+ isCurrentUser?: boolean;
38
+ isInCall?: boolean;
39
+ isSpeaking?: boolean;
40
+ isMuted?: boolean;
41
+ }>;
42
+ export type CollaboratorPointer = {
43
+ x: number;
44
+ y: number;
45
+ tool: "pointer" | "laser";
46
+ /**
47
+ * Whether to render cursor + username. Useful when you only want to render
48
+ * laser trail.
49
+ *
50
+ * @default true
51
+ */
52
+ renderCursor?: boolean;
53
+ /**
54
+ * Explicit laser color.
55
+ *
56
+ * @default string collaborator's cursor color
57
+ */
58
+ laserColor?: string;
59
+ };
60
+ export type DataURL = string & {
61
+ _brand: "DataURL";
62
+ };
63
+ export type BinaryFileData = {
64
+ mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
65
+ id: FileId;
66
+ dataURL: DataURL;
67
+ /**
68
+ * Epoch timestamp in milliseconds
69
+ */
70
+ created: number;
71
+ /**
72
+ * Indicates when the file was last retrieved from storage to be loaded
73
+ * onto the scene. We use this flag to determine whether to delete unused
74
+ * files from storage.
75
+ *
76
+ * Epoch timestamp in milliseconds.
77
+ */
78
+ lastRetrieved?: number;
79
+ /**
80
+ * indicates the version of the file. This can be used to determine whether
81
+ * the file dataURL has changed e.g. as part of restore due to schema update.
82
+ */
83
+ version?: number;
84
+ };
85
+ export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
86
+ export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
87
+ export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser" | "mermaid";
88
+ export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
89
+ export type ActiveTool = {
90
+ type: ToolType;
91
+ customType: null;
92
+ } | {
93
+ type: "custom";
94
+ customType: string;
95
+ };
96
+ export type SidebarName = string;
97
+ export type SidebarTabName = string;
98
+ export type UserToFollow = {
99
+ socketId: SocketId;
100
+ username: string;
101
+ };
102
+ type _CommonCanvasAppState = {
103
+ zoom: AppState["zoom"];
104
+ scrollX: AppState["scrollX"];
105
+ scrollY: AppState["scrollY"];
106
+ width: AppState["width"];
107
+ height: AppState["height"];
108
+ viewModeEnabled: AppState["viewModeEnabled"];
109
+ openDialog: AppState["openDialog"];
110
+ editingGroupId: AppState["editingGroupId"];
111
+ selectedElementIds: AppState["selectedElementIds"];
112
+ frameToHighlight: AppState["frameToHighlight"];
113
+ offsetLeft: AppState["offsetLeft"];
114
+ offsetTop: AppState["offsetTop"];
115
+ theme: AppState["theme"];
116
+ pendingImageElementId: AppState["pendingImageElementId"];
117
+ };
118
+ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
119
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
120
+ /** null indicates transparent bg */
121
+ viewBackgroundColor: AppState["viewBackgroundColor"] | null;
122
+ exportScale: AppState["exportScale"];
123
+ selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
124
+ gridSize: AppState["gridSize"];
125
+ gridStep: AppState["gridStep"];
126
+ frameRendering: AppState["frameRendering"];
127
+ linkOpacity: AppState["linkOpacity"];
128
+ gridColor: AppState["gridColor"];
129
+ gridDirection: AppState["gridDirection"];
130
+ frameColor: AppState["frameColor"];
131
+ currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
132
+ hoveredElementIds: AppState["hoveredElementIds"];
133
+ croppingElementId: AppState["croppingElementId"];
134
+ }>;
135
+ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
136
+ activeEmbeddable: AppState["activeEmbeddable"];
137
+ editingLinearElement: AppState["editingLinearElement"];
138
+ selectionElement: AppState["selectionElement"];
139
+ selectedGroupIds: AppState["selectedGroupIds"];
140
+ selectedLinearElement: AppState["selectedLinearElement"];
141
+ multiElement: AppState["multiElement"];
142
+ isBindingEnabled: AppState["isBindingEnabled"];
143
+ suggestedBindings: AppState["suggestedBindings"];
144
+ isRotating: AppState["isRotating"];
145
+ elementsToHighlight: AppState["elementsToHighlight"];
146
+ collaborators: AppState["collaborators"];
147
+ snapLines: AppState["snapLines"];
148
+ zenModeEnabled: AppState["zenModeEnabled"];
149
+ editingTextElement: AppState["editingTextElement"];
150
+ gridColor: AppState["gridColor"];
151
+ gridDirection: AppState["gridDirection"];
152
+ highlightSearchResult: AppState["highlightSearchResult"];
153
+ isCropping: AppState["isCropping"];
154
+ croppingElementId: AppState["croppingElementId"];
155
+ searchMatches: AppState["searchMatches"];
156
+ activeLockedId: AppState["activeLockedId"];
157
+ }>;
158
+ export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
159
+ export type ObservedStandaloneAppState = {
160
+ name: AppState["name"];
161
+ viewBackgroundColor: AppState["viewBackgroundColor"];
162
+ };
163
+ export type ObservedElementsAppState = {
164
+ editingGroupId: AppState["editingGroupId"];
165
+ selectedElementIds: AppState["selectedElementIds"];
166
+ selectedGroupIds: AppState["selectedGroupIds"];
167
+ editingLinearElementId: LinearElementEditor["elementId"] | null;
168
+ selectedLinearElementId: LinearElementEditor["elementId"] | null;
169
+ croppingElementId: AppState["croppingElementId"];
170
+ lockedMultiSelections: AppState["lockedMultiSelections"];
171
+ activeLockedId: AppState["activeLockedId"];
172
+ };
173
+ export interface AppState {
174
+ contextMenu: {
175
+ items: ContextMenuItems;
176
+ top: number;
177
+ left: number;
178
+ } | null;
179
+ showWelcomeScreen: boolean;
180
+ isLoading: boolean;
181
+ errorMessage: React.ReactNode;
182
+ activeEmbeddable: {
183
+ element: NonDeletedExcalidrawElement;
184
+ state: "hover" | "active";
185
+ } | null;
186
+ /**
187
+ * for a newly created element
188
+ * - set on pointer down, updated during pointer move, used on pointer up
189
+ */
190
+ newElement: NonDeleted<ExcalidrawNonSelectionElement> | null;
191
+ /**
192
+ * for a single element that's being resized
193
+ * - set on pointer down when it's selected and the active tool is selection
194
+ */
195
+ resizingElement: NonDeletedExcalidrawElement | null;
196
+ /**
197
+ * multiElement is for multi-point linear element that's created by clicking as opposed to dragging
198
+ * - when set and present, the editor will handle linear element creation logic accordingly
199
+ */
200
+ multiElement: NonDeleted<ExcalidrawLinearElement> | null;
201
+ /**
202
+ * decoupled from newElement, dragging selection only creates selectionElement
203
+ * - set on pointer down, updated during pointer move
204
+ */
205
+ selectionElement: NonDeletedExcalidrawElement | null;
206
+ isBindingEnabled: boolean;
207
+ startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
208
+ suggestedBindings: SuggestedBinding[];
209
+ frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
210
+ frameRendering: {
211
+ enabled: boolean;
212
+ name: boolean;
213
+ outline: boolean;
214
+ clip: boolean;
215
+ };
216
+ editingFrame: string | null;
217
+ elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
218
+ /**
219
+ * set when a new text is created or when an existing text is being edited
220
+ */
221
+ editingTextElement: NonDeletedExcalidrawElement | null;
222
+ editingLinearElement: LinearElementEditor | null;
223
+ activeTool: {
224
+ /**
225
+ * indicates a previous tool we should revert back to if we deselect the
226
+ * currently active tool. At the moment applies to `eraser` and `hand` tool.
227
+ */
228
+ lastActiveTool: ActiveTool | null;
229
+ locked: boolean;
230
+ fromSelection: boolean;
231
+ } & ActiveTool;
232
+ penMode: boolean;
233
+ penDetected: boolean;
234
+ exportBackground: boolean;
235
+ exportEmbedScene: boolean;
236
+ exportWithDarkMode: boolean;
237
+ exportScale: number;
238
+ currentItemStrokeColor: string;
239
+ currentItemBackgroundColor: string;
240
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
241
+ currentItemStrokeWidth: number;
242
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
243
+ currentItemRoughness: number;
244
+ currentItemOpacity: number;
245
+ currentItemFontFamily: FontFamilyValues;
246
+ currentItemFontSize: number;
247
+ currentItemTextAlign: TextAlign;
248
+ currentItemStartArrowhead: Arrowhead | null;
249
+ currentItemEndArrowhead: Arrowhead | null;
250
+ currentHoveredFontFamily: FontFamilyValues | null;
251
+ currentItemRoundness: StrokeRoundness;
252
+ currentItemArrowType: "sharp" | "round" | "elbow";
253
+ viewBackgroundColor: string;
254
+ scrollX: number;
255
+ scrollY: number;
256
+ cursorButton: "up" | "down";
257
+ scrolledOutside: boolean;
258
+ name: string | null;
259
+ isResizing: boolean;
260
+ isRotating: boolean;
261
+ zoom: Zoom;
262
+ openMenu: "canvas" | "shape" | null;
263
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
264
+ openSidebar: {
265
+ name: SidebarName;
266
+ tab?: SidebarTabName;
267
+ } | null;
268
+ openDialog: null | {
269
+ name: "imageExport" | "help" | "jsonExport";
270
+ } | {
271
+ name: "ttd";
272
+ tab: "text-to-diagram" | "mermaid";
273
+ } | {
274
+ name: "commandPalette";
275
+ } | {
276
+ name: "elementLinkSelector";
277
+ sourceElementId: ExcalidrawElement["id"];
278
+ };
279
+ /**
280
+ * Reflects user preference for whether the default sidebar should be docked.
281
+ *
282
+ * NOTE this is only a user preference and does not reflect the actual docked
283
+ * state of the sidebar, because the host apps can override this through
284
+ * a DefaultSidebar prop, which is not reflected back to the appState.
285
+ */
286
+ defaultSidebarDockedPreference: boolean;
287
+ lastPointerDownWith: PointerType;
288
+ selectedElementIds: Readonly<{
289
+ [id: string]: true;
290
+ }>;
291
+ hoveredElementIds: Readonly<{
292
+ [id: string]: true;
293
+ }>;
294
+ previousSelectedElementIds: {
295
+ [id: string]: true;
296
+ };
297
+ selectedElementsAreBeingDragged: boolean;
298
+ shouldCacheIgnoreZoom: boolean;
299
+ toast: {
300
+ message: string;
301
+ closable?: boolean;
302
+ duration?: number;
303
+ } | null;
304
+ zenModeEnabled: boolean;
305
+ theme: Theme;
306
+ /** grid cell px size */
307
+ gridSize: number;
308
+ gridStep: number;
309
+ gridModeEnabled: boolean;
310
+ viewModeEnabled: boolean;
311
+ /** top-most selected groups (i.e. does not include nested groups) */
312
+ selectedGroupIds: {
313
+ [groupId: string]: boolean;
314
+ };
315
+ /** group being edited when you drill down to its constituent element
316
+ (e.g. when you double-click on a group's element) */
317
+ editingGroupId: GroupId | null;
318
+ width: number;
319
+ height: number;
320
+ offsetTop: number;
321
+ offsetLeft: number;
322
+ fileHandle: FileSystemHandle | null;
323
+ collaborators: Map<SocketId, Collaborator>;
324
+ stats: {
325
+ open: boolean;
326
+ /** bitmap. Use `STATS_PANELS` bit values */
327
+ panels: number;
328
+ };
329
+ currentChartType: ChartType;
330
+ pasteDialog: {
331
+ shown: false;
332
+ data: null;
333
+ } | {
334
+ shown: true;
335
+ data: Spreadsheet;
336
+ };
337
+ /** imageElement waiting to be placed on canvas */
338
+ pendingImageElementId: ExcalidrawImageElement["id"] | null;
339
+ showHyperlinkPopup: false | "info" | "editor";
340
+ linkOpacity: number;
341
+ trayModeEnabled: boolean;
342
+ colorPalette?: {
343
+ canvasBackground: ColorPaletteCustom;
344
+ elementBackground: ColorPaletteCustom;
345
+ elementStroke: ColorPaletteCustom;
346
+ topPicks: {
347
+ canvasBackground: [string, string, string, string, string];
348
+ elementStroke: [string, string, string, string, string];
349
+ elementBackground: [string, string, string, string, string];
350
+ };
351
+ };
352
+ allowWheelZoom?: boolean;
353
+ allowPinchZoom?: boolean;
354
+ pinnedScripts?: string[];
355
+ customPens?: any[];
356
+ currentStrokeOptions?: any;
357
+ resetCustomPen?: any;
358
+ gridColor: {
359
+ Bold: string;
360
+ Regular: string;
361
+ };
362
+ gridDirection: {
363
+ horizontal: boolean;
364
+ vertical: boolean;
365
+ };
366
+ highlightSearchResult: boolean;
367
+ dynamicStyle: {
368
+ [x: string]: string;
369
+ };
370
+ frameColor: {
371
+ stroke: string;
372
+ fill: string;
373
+ nameColor: string;
374
+ };
375
+ invertBindingBehaviour: boolean;
376
+ selectedLinearElement: LinearElementEditor | null;
377
+ snapLines: readonly SnapLine[];
378
+ originSnapOffset: {
379
+ x: number;
380
+ y: number;
381
+ } | null;
382
+ objectsSnapModeEnabled: boolean;
383
+ /** the user's socket id & username who is being followed on the canvas */
384
+ userToFollow: UserToFollow | null;
385
+ /** the socket ids of the users following the current user */
386
+ followedBy: Set<SocketId>;
387
+ /** image cropping */
388
+ isCropping: boolean;
389
+ croppingElementId: ExcalidrawElement["id"] | null;
390
+ /** null if no search matches found / search closed */
391
+ searchMatches: Readonly<{
392
+ focusedId: ExcalidrawElement["id"] | null;
393
+ matches: readonly SearchMatch[];
394
+ }> | null;
395
+ /** the locked element/group that's active and shows unlock popup */
396
+ activeLockedId: string | null;
397
+ lockedMultiSelections: {
398
+ [groupId: string]: true;
399
+ };
400
+ }
401
+ export type SearchMatch = {
402
+ id: string;
403
+ focus: boolean;
404
+ matchedLines: {
405
+ offsetX: number;
406
+ offsetY: number;
407
+ width: number;
408
+ height: number;
409
+ showOnCanvas: boolean;
410
+ }[];
411
+ };
412
+ export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
413
+ export type NormalizedZoomValue = number & {
414
+ _brand: "normalizedZoom";
415
+ };
416
+ export type Zoom = Readonly<{
417
+ value: NormalizedZoomValue;
418
+ }>;
419
+ export type PointerCoords = Readonly<{
420
+ x: number;
421
+ y: number;
422
+ }>;
423
+ export type Gesture = {
424
+ pointers: Map<number, PointerCoords>;
425
+ lastCenter: {
426
+ x: number;
427
+ y: number;
428
+ } | null;
429
+ initialDistance: number | null;
430
+ initialScale: number | null;
431
+ };
432
+ export declare class GestureEvent extends UIEvent {
433
+ readonly rotation: number;
434
+ readonly scale: number;
435
+ }
436
+ /** @deprecated legacy: do not use outside of migration paths */
437
+ export type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
438
+ /** @deprecated legacy: do not use outside of migration paths */
439
+ type LibraryItems_v1 = readonly LibraryItem_v1[];
440
+ /** v2 library item */
441
+ export type LibraryItem = {
442
+ id: string;
443
+ status: "published" | "unpublished";
444
+ elements: readonly NonDeleted<ExcalidrawElement>[];
445
+ /** timestamp in epoch (ms) */
446
+ created: number;
447
+ name?: string;
448
+ error?: string;
449
+ };
450
+ export type LibraryItems = readonly LibraryItem[];
451
+ export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
452
+ export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePromise<LibraryItems_anyVersion | Blob>) | MaybePromise<LibraryItems_anyVersion | Blob>;
453
+ export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
454
+ libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
455
+ }>;
456
+ export type OnUserFollowedPayload = {
457
+ userToFollow: UserToFollow;
458
+ action: "FOLLOW" | "UNFOLLOW";
459
+ };
460
+ export interface ExcalidrawProps {
461
+ onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
462
+ onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
463
+ initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
464
+ excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
465
+ isCollaborating?: boolean;
466
+ onPointerUpdate?: (payload: {
467
+ pointer: {
468
+ x: number;
469
+ y: number;
470
+ tool: "pointer" | "laser";
471
+ };
472
+ button: "down" | "up";
473
+ pointersMap: Gesture["pointers"];
474
+ }) => void;
475
+ onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
476
+ onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
477
+ /**
478
+ * Called when element(s) are duplicated so you can listen or modify as
479
+ * needed.
480
+ *
481
+ * Called when duplicating via mouse-drag, keyboard, paste, library insert
482
+ * etc.
483
+ *
484
+ * Returned elements will be used in place of the next elements
485
+ * (you should return all elements, including deleted, and not mutate
486
+ * the element if changes are made)
487
+ */
488
+ onDuplicate?: (nextElements: readonly ExcalidrawElement[],
489
+ /** excludes the duplicated elements */
490
+ prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
491
+ renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
492
+ langCode?: Language["code"];
493
+ viewModeEnabled?: boolean;
494
+ zenModeEnabled?: boolean;
495
+ gridModeEnabled?: boolean;
496
+ objectsSnapModeEnabled?: boolean;
497
+ libraryReturnUrl?: string;
498
+ initState?: AppState;
499
+ theme?: Theme;
500
+ name?: string;
501
+ renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
502
+ UIOptions?: Partial<UIOptions>;
503
+ detectScroll?: boolean;
504
+ handleKeyboardGlobally?: boolean;
505
+ onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
506
+ autoFocus?: boolean;
507
+ onBeforeTextEdit?: (textElement: ExcalidrawTextElement, isExistingElement: boolean) => string;
508
+ onBeforeTextSubmit?: (textElement: ExcalidrawTextElement, nextText: string, //wrapped
509
+ nextOriginalText: string, isDeleted: boolean) => {
510
+ updatedNextOriginalText: string;
511
+ nextLink: string;
512
+ };
513
+ generateIdForFile?: (file: File) => string | Promise<string>;
514
+ onThemeChange?: (newTheme: string) => void;
515
+ onViewModeChange?: (isViewModeEnabled: boolean) => void;
516
+ generateLinkForSelection?: (id: string, type: "element" | "group") => string;
517
+ onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
518
+ nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
519
+ }>) => void;
520
+ onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
521
+ onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
522
+ onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
523
+ onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
524
+ onUserFollow?: (payload: OnUserFollowedPayload) => void;
525
+ children?: React.ReactNode;
526
+ validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
527
+ renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
528
+ renderWebview?: boolean;
529
+ renderEmbeddableMenu?: (appState: AppState) => JSX.Element | null;
530
+ renderMermaid?: boolean;
531
+ onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
532
+ aiEnabled?: boolean;
533
+ showDeprecatedFonts?: boolean;
534
+ insertLinkAction?: (linkVal: string) => void;
535
+ renderScrollbars?: boolean;
536
+ }
537
+ export type SceneData = {
538
+ elements?: ImportedDataState["elements"];
539
+ appState?: ImportedDataState["appState"];
540
+ collaborators?: Map<SocketId, Collaborator>;
541
+ captureUpdate?: CaptureUpdateActionType;
542
+ };
543
+ export type ExportOpts = {
544
+ saveFileToDisk?: boolean;
545
+ onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
546
+ renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
547
+ };
548
+ export type CanvasActions = Partial<{
549
+ changeViewBackgroundColor: boolean;
550
+ clearCanvas: boolean;
551
+ export: false | ExportOpts;
552
+ loadScene: boolean;
553
+ saveToActiveFile: boolean;
554
+ toggleTheme: boolean | null;
555
+ saveAsImage: boolean;
556
+ }>;
557
+ export type UIOptions = Partial<{
558
+ dockedSidebarBreakpoint: number;
559
+ canvasActions: CanvasActions;
560
+ tools: {
561
+ image: boolean;
562
+ };
563
+ /** @deprecated does nothing. Will be removed in 0.15 */
564
+ welcomeScreen?: boolean;
565
+ }>;
566
+ export type AppProps = Merge<ExcalidrawProps, {
567
+ UIOptions: Merge<UIOptions, {
568
+ canvasActions: Required<CanvasActions> & {
569
+ export: ExportOpts;
570
+ };
571
+ }>;
572
+ detectScroll: boolean;
573
+ handleKeyboardGlobally: boolean;
574
+ isCollaborating: boolean;
575
+ children?: React.ReactNode;
576
+ aiEnabled: boolean;
577
+ }>;
578
+ /** A subset of App class properties that we need to use elsewhere
579
+ * in the app, eg Manager. Factored out into a separate type to keep DRY. */
580
+ export type AppClassProperties = {
581
+ props: AppProps;
582
+ state: AppState;
583
+ interactiveCanvas: HTMLCanvasElement | null;
584
+ /** static canvas */
585
+ canvas: HTMLCanvasElement;
586
+ focusContainer(): void;
587
+ library: Library;
588
+ imageCache: Map<FileId, {
589
+ image: HTMLImageElement | Promise<HTMLImageElement>;
590
+ mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
591
+ }>;
592
+ files: BinaryFiles;
593
+ device: App["device"];
594
+ scene: App["scene"];
595
+ syncActionResult: App["syncActionResult"];
596
+ fonts: App["fonts"];
597
+ pasteFromClipboard: App["pasteFromClipboard"];
598
+ id: App["id"];
599
+ onInsertElements: App["onInsertElements"];
600
+ onExportImage: App["onExportImage"];
601
+ lastViewportPosition: App["lastViewportPosition"];
602
+ scrollToContent: App["scrollToContent"];
603
+ addFiles: App["addFiles"];
604
+ addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
605
+ setSelection: App["setSelection"];
606
+ togglePenMode: App["togglePenMode"];
607
+ toggleLock: App["toggleLock"];
608
+ setActiveTool: App["setActiveTool"];
609
+ setOpenDialog: App["setOpenDialog"];
610
+ insertEmbeddableElement: App["insertEmbeddableElement"];
611
+ onMagicframeToolSelect: App["onMagicframeToolSelect"];
612
+ getName: App["getName"];
613
+ dismissLinearEditor: App["dismissLinearEditor"];
614
+ flowChartCreator: App["flowChartCreator"];
615
+ getEffectiveGridSize: App["getEffectiveGridSize"];
616
+ setPlugins: App["setPlugins"];
617
+ plugins: App["plugins"];
618
+ getEditorUIOffsets: App["getEditorUIOffsets"];
619
+ visibleElements: App["visibleElements"];
620
+ excalidrawContainerValue: App["excalidrawContainerValue"];
621
+ onPointerUpEmitter: App["onPointerUpEmitter"];
622
+ updateEditorAtom: App["updateEditorAtom"];
623
+ };
624
+ export type PointerDownState = Readonly<{
625
+ origin: Readonly<{
626
+ x: number;
627
+ y: number;
628
+ }>;
629
+ originInGrid: Readonly<{
630
+ x: number;
631
+ y: number;
632
+ }>;
633
+ scrollbars: ReturnType<typeof isOverScrollBars>;
634
+ lastCoords: {
635
+ x: number;
636
+ y: number;
637
+ };
638
+ originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
639
+ resize: {
640
+ handleType: MaybeTransformHandleType;
641
+ isResizing: boolean;
642
+ offset: {
643
+ x: number;
644
+ y: number;
645
+ };
646
+ arrowDirection: "origin" | "end";
647
+ center: {
648
+ x: number;
649
+ y: number;
650
+ };
651
+ };
652
+ hit: {
653
+ element: NonDeleted<ExcalidrawElement> | null;
654
+ allHitElements: NonDeleted<ExcalidrawElement>[];
655
+ wasAddedToSelection: boolean;
656
+ hasBeenDuplicated: boolean;
657
+ hasHitCommonBoundingBoxOfSelectedElements: boolean;
658
+ };
659
+ withCmdOrCtrl: boolean;
660
+ drag: {
661
+ hasOccurred: boolean;
662
+ offset: {
663
+ x: number;
664
+ y: number;
665
+ } | null;
666
+ origin: {
667
+ x: number;
668
+ y: number;
669
+ };
670
+ };
671
+ eventListeners: {
672
+ onMove: null | ReturnType<typeof throttleRAF>;
673
+ onUp: null | ((event: PointerEvent) => void);
674
+ onKeyDown: null | ((event: KeyboardEvent) => void);
675
+ onKeyUp: null | ((event: KeyboardEvent) => void);
676
+ };
677
+ boxSelection: {
678
+ hasOccurred: boolean;
679
+ };
680
+ }>;
681
+ export type UnsubscribeCallback = () => void;
682
+ export interface ExcalidrawImperativeAPI {
683
+ updateScene: InstanceType<typeof App>["updateScene"];
684
+ mutateElement: InstanceType<typeof App>["mutateElement"];
685
+ updateLibrary: InstanceType<typeof Library>["updateLibrary"];
686
+ resetScene: InstanceType<typeof App>["resetScene"];
687
+ getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
688
+ history: {
689
+ clear: InstanceType<typeof App>["resetHistory"];
690
+ };
691
+ setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
692
+ zoomToFit: InstanceType<typeof App>["zoomToFit"];
693
+ getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
694
+ startLineEditor: InstanceType<typeof App>["startLineEditor"];
695
+ getSceneElements: InstanceType<typeof App>["getSceneElements"];
696
+ getAppState: () => InstanceType<typeof App>["state"];
697
+ getFiles: () => InstanceType<typeof App>["files"];
698
+ getName: InstanceType<typeof App>["getName"];
699
+ scrollToContent: InstanceType<typeof App>["scrollToContent"];
700
+ registerAction: (action: Action) => void;
701
+ refresh: InstanceType<typeof App>["refresh"];
702
+ setToast: InstanceType<typeof App>["setToast"];
703
+ addFiles: (data: BinaryFileData[]) => void;
704
+ updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
705
+ id: string;
706
+ selectElements: (elements: readonly ExcalidrawElement[], highlightSearchResult?: boolean) => void;
707
+ sendBackward: (elements: readonly ExcalidrawElement[]) => void;
708
+ bringForward: (elements: readonly ExcalidrawElement[]) => void;
709
+ sendToBack: (elements: readonly ExcalidrawElement[]) => void;
710
+ bringToFront: (elements: readonly ExcalidrawElement[]) => void;
711
+ setMobileModeAllowed: (allow: boolean) => void;
712
+ setActiveTool: InstanceType<typeof App>["setActiveTool"];
713
+ setCursor: InstanceType<typeof App>["setCursor"];
714
+ resetCursor: InstanceType<typeof App>["resetCursor"];
715
+ toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
716
+ getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
717
+ /**
718
+ * Disables rendering of frames (including element clipping), but currently
719
+ * the frames are still interactive in edit mode. As such, this API should be
720
+ * used in conjunction with view mode (props.viewModeEnabled).
721
+ */
722
+ updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
723
+ onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
724
+ onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
725
+ onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
726
+ onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
727
+ onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
728
+ onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
729
+ }
730
+ export type Device = Readonly<{
731
+ viewport: {
732
+ isMobile: boolean;
733
+ isLandscape: boolean;
734
+ };
735
+ editor: {
736
+ isMobile: boolean;
737
+ canFitSidebar: boolean;
738
+ };
739
+ isTouchScreen: boolean;
740
+ }>;
741
+ export type FrameNameBounds = {
742
+ x: number;
743
+ y: number;
744
+ width: number;
745
+ height: number;
746
+ angle: number;
747
+ };
748
+ export type FrameNameBoundsCache = {
749
+ get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
750
+ _cache: Map<string, FrameNameBounds & {
751
+ zoom: AppState["zoom"]["value"];
752
+ versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
753
+ }>;
754
+ };
755
+ export type KeyboardModifiersObject = {
756
+ ctrlKey: boolean;
757
+ shiftKey: boolean;
758
+ altKey: boolean;
759
+ metaKey: boolean;
760
+ };
761
+ export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
762
+ export type JSONValue = string | number | boolean | null | object;
763
+ export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
764
+ export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
765
+ export type PendingExcalidrawElements = ExcalidrawElement[];
766
+ /** Runtime gridSize value. Null indicates disabled grid. */
767
+ export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
768
+ export type GenerateDiagramToCode = (props: {
769
+ frame: ExcalidrawMagicFrameElement;
770
+ children: readonly ExcalidrawElement[];
771
+ }) => MaybePromise<{
772
+ html: string;
773
+ }>;
774
+ export type Offsets = Partial<{
775
+ top: number;
776
+ right: number;
777
+ bottom: number;
778
+ left: number;
779
+ }>;
780
+ export {};