@zsviczian/excalidraw 0.18.0-13 → 0.18.0-14

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