@zsviczian/excalidraw 0.18.0-12 → 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 (390) hide show
  1. package/dist/excalidraw.development.js +210 -177
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +16 -0
  4. package/dist/styles.production.css +1 -0
  5. package/package.json +1 -1
  6. package/types/common/src/binary-heap.d.ts +12 -12
  7. package/types/common/src/colors.d.ts +62 -62
  8. package/types/common/src/constants.d.ts +337 -336
  9. package/types/{excalidraw → common/src}/emitter.d.ts +16 -16
  10. package/types/common/src/font-metadata.d.ts +46 -46
  11. package/types/common/src/index.d.ts +12 -11
  12. package/types/common/src/keys.d.ts +189 -189
  13. package/types/common/src/points.d.ts +9 -9
  14. package/types/common/src/promise-pool.d.ts +6 -6
  15. package/types/common/src/queue.d.ts +9 -9
  16. package/types/common/src/random.d.ts +4 -4
  17. package/types/common/src/url.d.ts +7 -7
  18. package/types/common/src/utility-types.d.ts +37 -32
  19. package/types/common/src/utils.d.ts +266 -257
  20. package/types/element/src/Scene.d.ts +76 -76
  21. package/types/element/src/Shape.d.ts +17 -17
  22. package/types/element/src/ShapeCache.d.ts +25 -25
  23. package/types/element/src/align.d.ts +7 -7
  24. package/types/element/src/binding.d.ts +108 -100
  25. package/types/element/src/bounds.d.ts +81 -81
  26. package/types/element/src/collision.d.ts +26 -26
  27. package/types/element/src/comparisons.d.ts +8 -8
  28. package/types/element/src/containerCache.d.ts +11 -11
  29. package/types/element/src/cropElement.d.ts +19 -19
  30. package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +196 -191
  31. package/types/element/src/distance.d.ts +3 -3
  32. package/types/element/src/distribute.d.ts +6 -6
  33. package/types/element/src/dragElements.d.ts +33 -33
  34. package/types/element/src/duplicate.d.ts +63 -63
  35. package/types/element/src/easingFunctions.d.ts +6 -6
  36. package/types/element/src/elbowArrow.d.ts +17 -17
  37. package/types/element/src/elementLink.d.ts +13 -13
  38. package/types/element/src/embeddable.d.ts +10 -10
  39. package/types/element/src/flowchart.d.ts +26 -26
  40. package/types/element/src/fractionalIndex.d.ts +51 -51
  41. package/types/element/src/frame.d.ts +69 -69
  42. package/types/element/src/groups.d.ts +33 -33
  43. package/types/element/src/heading.d.ts +15 -15
  44. package/types/element/src/image.d.ts +32 -32
  45. package/types/element/src/index.d.ts +16 -16
  46. package/types/element/src/linearElementEditor.d.ts +125 -129
  47. package/types/element/src/mutateElement.d.ts +21 -21
  48. package/types/element/src/newElement.d.ts +62 -62
  49. package/types/element/src/renderElement.d.ts +28 -28
  50. package/types/element/src/resizeElements.d.ts +38 -38
  51. package/types/element/src/resizeTest.d.ts +15 -15
  52. package/types/element/src/selection.d.ts +43 -43
  53. package/types/element/src/shapes.d.ts +23 -23
  54. package/types/element/src/showSelectedShapeActions.d.ts +3 -3
  55. package/types/element/src/sizeHelpers.d.ts +34 -34
  56. package/types/element/src/sortElements.d.ts +2 -2
  57. package/types/element/src/store.d.ts +227 -0
  58. package/types/element/src/textElement.d.ts +40 -40
  59. package/types/element/src/textMeasurements.d.ts +41 -41
  60. package/types/element/src/textWrapping.d.ts +13 -13
  61. package/types/element/src/transformHandles.d.ts +55 -55
  62. package/types/element/src/typeChecks.d.ts +42 -39
  63. package/types/element/src/types.d.ts +292 -285
  64. package/types/element/src/utils.d.ts +21 -21
  65. package/types/element/src/zindex.d.ts +7 -7
  66. package/types/excalidraw/actions/actionAddToLibrary.d.ts +644 -644
  67. package/types/excalidraw/actions/actionAlign.d.ts +109 -109
  68. package/types/excalidraw/actions/actionBoundText.d.ts +466 -466
  69. package/types/excalidraw/actions/actionCanvas.d.ts +3353 -3353
  70. package/types/excalidraw/actions/actionClipboard.d.ts +1404 -1404
  71. package/types/excalidraw/actions/actionCropEditor.d.ts +227 -227
  72. package/types/excalidraw/actions/actionDeleteSelected.d.ts +683 -683
  73. package/types/excalidraw/actions/actionDistribute.d.ts +34 -34
  74. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +17 -17
  75. package/types/excalidraw/actions/actionElementLink.d.ts +249 -249
  76. package/types/excalidraw/actions/actionElementLock.d.ts +453 -453
  77. package/types/excalidraw/actions/actionEmbeddable.d.ts +224 -224
  78. package/types/excalidraw/actions/actionExport.d.ts +1998 -1998
  79. package/types/excalidraw/actions/actionFinalize.d.ts +435 -435
  80. package/types/excalidraw/actions/actionFlip.d.ts +34 -34
  81. package/types/excalidraw/actions/actionFrame.d.ts +1404 -1404
  82. package/types/excalidraw/actions/actionGroup.d.ts +464 -464
  83. package/types/excalidraw/actions/actionHistory.d.ts +6 -7
  84. package/types/excalidraw/actions/actionLinearEditor.d.ts +228 -228
  85. package/types/excalidraw/actions/actionLink.d.ts +228 -228
  86. package/types/excalidraw/actions/actionMenu.d.ts +664 -664
  87. package/types/excalidraw/actions/actionNavigate.d.ts +440 -440
  88. package/types/excalidraw/actions/actionProperties.d.ts +3351 -3351
  89. package/types/excalidraw/actions/actionSelectAll.d.ts +227 -227
  90. package/types/excalidraw/actions/actionStyles.d.ts +241 -241
  91. package/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -17
  92. package/types/excalidraw/actions/actionToggleGridMode.d.ts +230 -230
  93. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +228 -228
  94. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +430 -430
  95. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  96. package/types/excalidraw/actions/actionToggleStats.d.ts +227 -227
  97. package/types/excalidraw/actions/actionToggleViewMode.d.ts +228 -228
  98. package/types/excalidraw/actions/actionToggleZenMode.d.ts +228 -228
  99. package/types/excalidraw/actions/actionZindex.d.ts +74 -74
  100. package/types/excalidraw/actions/index.d.ts +28 -28
  101. package/types/excalidraw/actions/manager.d.ts +21 -21
  102. package/types/excalidraw/actions/register.d.ts +5 -5
  103. package/types/excalidraw/actions/shortcuts.d.ts +4 -4
  104. package/types/excalidraw/actions/types.d.ts +46 -46
  105. package/types/excalidraw/analytics.d.ts +1 -1
  106. package/types/excalidraw/animated-trail.d.ts +39 -39
  107. package/types/excalidraw/animation-frame-handler.d.ts +16 -16
  108. package/types/excalidraw/appState.d.ts +90 -90
  109. package/types/excalidraw/charts.d.ts +27 -27
  110. package/types/excalidraw/clients.d.ts +14 -14
  111. package/types/excalidraw/clipboard.d.ts +66 -66
  112. package/types/excalidraw/components/Actions.d.ts +35 -35
  113. package/types/excalidraw/components/ActiveConfirmDialog.d.ts +4 -4
  114. package/types/excalidraw/components/App.d.ts +566 -564
  115. package/types/excalidraw/components/Avatar.d.ts +11 -11
  116. package/types/excalidraw/components/BraveMeasureTextError.d.ts +2 -2
  117. package/types/excalidraw/components/Button.d.ts +17 -17
  118. package/types/excalidraw/components/ButtonIcon.d.ts +15 -15
  119. package/types/excalidraw/components/ButtonIconCycle.d.ts +11 -11
  120. package/types/excalidraw/components/ButtonIconSelect.d.ts +20 -20
  121. package/types/excalidraw/components/ButtonSelect.d.ts +9 -9
  122. package/types/excalidraw/components/ButtonSeparator.d.ts +1 -1
  123. package/types/excalidraw/components/Card.d.ts +6 -6
  124. package/types/excalidraw/components/CheckboxItem.d.ts +8 -8
  125. package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +9 -9
  126. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +19 -19
  127. package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +8 -8
  128. package/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +7 -7
  129. package/types/excalidraw/components/ColorPicker/Picker.d.ts +18 -18
  130. package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -10
  131. package/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +5 -5
  132. package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +8 -8
  133. package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +9 -9
  134. package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +21 -21
  135. package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +20 -20
  136. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +18 -18
  137. package/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -2
  138. package/types/excalidraw/components/CommandPalette/types.d.ts +25 -25
  139. package/types/excalidraw/components/ConfirmDialog.d.ts +10 -10
  140. package/types/excalidraw/components/ContextMenu.d.ts +16 -16
  141. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +49 -0
  142. package/types/excalidraw/components/DarkModeToggle.d.ts +7 -7
  143. package/types/excalidraw/components/DefaultSidebar.d.ts +30 -30
  144. package/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +4 -4
  145. package/types/excalidraw/components/Dialog.d.ts +13 -13
  146. package/types/excalidraw/components/DialogActionButton.d.ts +10 -10
  147. package/types/excalidraw/components/ElementCanvasButtons.d.ts +7 -7
  148. package/types/excalidraw/components/ElementLinkDialog.d.ts +12 -12
  149. package/types/excalidraw/components/ErrorDialog.d.ts +5 -5
  150. package/types/excalidraw/components/ExcalidrawLogo.d.ts +15 -15
  151. package/types/excalidraw/components/EyeDropper.d.ts +27 -27
  152. package/types/excalidraw/components/FilledButton.d.ts +18 -18
  153. package/types/excalidraw/components/FixedSideContainer.d.ts +9 -9
  154. package/types/excalidraw/components/FollowMode/FollowMode.d.ts +10 -10
  155. package/types/excalidraw/components/FontPicker/FontPicker.d.ts +21 -21
  156. package/types/excalidraw/components/FontPicker/FontPickerList.d.ts +26 -26
  157. package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +6 -6
  158. package/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +13 -13
  159. package/types/excalidraw/components/HandButton.d.ts +10 -10
  160. package/types/excalidraw/components/HelpButton.d.ts +7 -7
  161. package/types/excalidraw/components/HelpDialog.d.ts +4 -4
  162. package/types/excalidraw/components/HintViewer.d.ts +10 -10
  163. package/types/excalidraw/components/IconPicker.d.ts +15 -15
  164. package/types/excalidraw/components/ImageExportDialog.d.ts +14 -14
  165. package/types/excalidraw/components/InitializeApp.d.ts +10 -10
  166. package/types/excalidraw/components/InlineIcon.d.ts +3 -3
  167. package/types/excalidraw/components/Island.d.ts +10 -10
  168. package/types/excalidraw/components/JSONExportDialog.d.ts +15 -15
  169. package/types/excalidraw/components/LaserPointerButton.d.ts +10 -10
  170. package/types/excalidraw/components/LayerUI.d.ts +31 -31
  171. package/types/excalidraw/components/LibraryMenu.d.ts +10 -10
  172. package/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +7 -7
  173. package/types/excalidraw/components/LibraryMenuControlButtons.d.ts +9 -9
  174. package/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +17 -17
  175. package/types/excalidraw/components/LibraryMenuItems.d.ts +14 -14
  176. package/types/excalidraw/components/LibraryMenuSection.d.ts +23 -23
  177. package/types/excalidraw/components/LibraryUnit.d.ts +14 -14
  178. package/types/excalidraw/components/LoadingMessage.d.ts +5 -5
  179. package/types/excalidraw/components/LockButton.d.ts +10 -10
  180. package/types/excalidraw/components/MagicButton.d.ts +10 -10
  181. package/types/excalidraw/components/MobileMenu.d.ts +25 -25
  182. package/types/excalidraw/components/Modal.d.ts +14 -14
  183. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -17
  184. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -17
  185. package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -22
  186. package/types/excalidraw/components/Paragraph.d.ts +4 -4
  187. package/types/excalidraw/components/PasteChartDialog.d.ts +8 -8
  188. package/types/excalidraw/components/PenModeButton.d.ts +12 -12
  189. package/types/excalidraw/components/Popover.d.ts +15 -15
  190. package/types/excalidraw/components/ProjectName.d.ts +10 -10
  191. package/types/excalidraw/components/PropertiesPopover.d.ts +15 -15
  192. package/types/excalidraw/components/PublishLibrary.d.ts +16 -16
  193. package/types/excalidraw/components/QuickSearch.d.ts +9 -9
  194. package/types/excalidraw/components/RadioGroup.d.ts +13 -13
  195. package/types/excalidraw/components/Range.d.ts +8 -8
  196. package/types/excalidraw/components/SVGLayer.d.ts +7 -7
  197. package/types/excalidraw/components/ScrollableList.d.ts +8 -8
  198. package/types/excalidraw/components/SearchMenu.d.ts +5 -5
  199. package/types/excalidraw/components/Section.d.ts +6 -6
  200. package/types/excalidraw/components/ShareableLinkDialog.d.ts +7 -7
  201. package/types/excalidraw/components/Sidebar/Sidebar.d.ts +76 -76
  202. package/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +7 -7
  203. package/types/excalidraw/components/Sidebar/SidebarTab.d.ts +8 -8
  204. package/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +9 -9
  205. package/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +6 -6
  206. package/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +6 -6
  207. package/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +6 -6
  208. package/types/excalidraw/components/Sidebar/common.d.ts +34 -34
  209. package/types/excalidraw/components/Spinner.d.ts +8 -8
  210. package/types/excalidraw/components/Stack.d.ts +15 -15
  211. package/types/excalidraw/components/Stats/Angle.d.ts +11 -11
  212. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +10 -10
  213. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +10 -10
  214. package/types/excalidraw/components/Stats/Collapsible.d.ts +9 -9
  215. package/types/excalidraw/components/Stats/Dimension.d.ts +11 -11
  216. package/types/excalidraw/components/Stats/DragInput.d.ts +34 -34
  217. package/types/excalidraw/components/Stats/FontSize.d.ts +11 -11
  218. package/types/excalidraw/components/Stats/MultiAngle.d.ts +11 -11
  219. package/types/excalidraw/components/Stats/MultiDimension.d.ts +14 -14
  220. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +12 -12
  221. package/types/excalidraw/components/Stats/MultiPosition.d.ts +14 -14
  222. package/types/excalidraw/components/Stats/Position.d.ts +12 -12
  223. package/types/excalidraw/components/Stats/index.d.ts +35 -35
  224. package/types/excalidraw/components/Stats/utils.d.ts +19 -26
  225. package/types/excalidraw/components/Switch.d.ts +9 -9
  226. package/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +8 -8
  227. package/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib.d.ts +10 -10
  228. package/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +29 -29
  229. package/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +9 -9
  230. package/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +7 -7
  231. package/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +17 -17
  232. package/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +4 -4
  233. package/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -1
  234. package/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +7 -7
  235. package/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -8
  236. package/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -6
  237. package/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +11 -11
  238. package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +9 -9
  239. package/types/excalidraw/components/TTDDialog/common.d.ts +32 -32
  240. package/types/excalidraw/components/TextField.d.ts +21 -21
  241. package/types/excalidraw/components/Toast.d.ts +9 -9
  242. package/types/excalidraw/components/ToolButton.d.ts +49 -49
  243. package/types/excalidraw/components/Tooltip.d.ts +18 -18
  244. package/types/excalidraw/components/Trans.d.ts +9 -9
  245. package/types/excalidraw/components/UserList.d.ts +18 -18
  246. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +30 -30
  247. package/types/excalidraw/components/canvases/NewElementCanvas.d.ts +14 -14
  248. package/types/excalidraw/components/canvases/StaticCanvas.d.ts +19 -19
  249. package/types/excalidraw/components/canvases/index.d.ts +3 -3
  250. package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +86 -86
  251. package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +15 -15
  252. package/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -11
  253. package/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +46 -46
  254. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +8 -8
  255. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +17 -17
  256. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -7
  257. package/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +16 -16
  258. package/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -5
  259. package/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -10
  260. package/types/excalidraw/components/dropdownMenu/common.d.ts +6 -6
  261. package/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -3
  262. package/types/excalidraw/components/footer/Footer.d.ts +12 -12
  263. package/types/excalidraw/components/footer/FooterCenter.d.ts +8 -8
  264. package/types/excalidraw/components/hoc/withInternalFallback.d.ts +4 -4
  265. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -19
  266. package/types/excalidraw/components/hyperlink/helpers.d.ts +9 -9
  267. package/types/excalidraw/components/icons.d.ts +224 -224
  268. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -9
  269. package/types/excalidraw/components/main-menu/DefaultItems.d.ts +64 -64
  270. package/types/excalidraw/components/main-menu/MainMenu.d.ts +83 -83
  271. package/types/excalidraw/components/shapes.d.ts +62 -62
  272. package/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +60 -60
  273. package/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -19
  274. package/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +86 -86
  275. package/types/excalidraw/context/tunnels.d.ts +21 -21
  276. package/types/excalidraw/context/ui-appState.d.ts +4 -4
  277. package/types/excalidraw/cursor.d.ts +6 -6
  278. package/types/excalidraw/data/EditorLocalStorage.d.ts +8 -8
  279. package/types/excalidraw/data/ai/types.d.ts +242 -242
  280. package/types/excalidraw/data/blob.d.ts +53 -53
  281. package/types/excalidraw/data/encode.d.ts +55 -55
  282. package/types/excalidraw/data/encryption.d.ts +9 -9
  283. package/types/excalidraw/data/filesystem.d.ts +21 -21
  284. package/types/excalidraw/data/image.d.ts +9 -9
  285. package/types/excalidraw/data/index.d.ts +22 -22
  286. package/types/excalidraw/data/json.d.ts +16 -16
  287. package/types/excalidraw/data/library.d.ts +112 -112
  288. package/types/excalidraw/data/reconcile.d.ts +6 -6
  289. package/types/excalidraw/data/resave.d.ts +5 -5
  290. package/types/excalidraw/data/restore.d.ts +21 -21
  291. package/types/excalidraw/data/transform.d.ts +81 -81
  292. package/types/excalidraw/data/types.d.ts +45 -45
  293. package/types/excalidraw/deburr.d.ts +1 -1
  294. package/types/excalidraw/dist/excalidraw.development.d.ts +2 -2
  295. package/types/excalidraw/dist/excalidraw.production.min.d.ts +3 -3
  296. package/types/excalidraw/editor-jotai.d.ts +56 -56
  297. package/types/excalidraw/entry.d.ts +1 -1
  298. package/types/excalidraw/env.d.cts +1 -1
  299. package/types/excalidraw/env.d.ts +1 -1
  300. package/types/excalidraw/eraser/index.d.ts +14 -14
  301. package/types/excalidraw/errors.d.ts +29 -29
  302. package/types/excalidraw/fonts/Cascadia/index.d.ts +2 -2
  303. package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -2
  304. package/types/excalidraw/fonts/Emoji/index.d.ts +2 -2
  305. package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +29 -29
  306. package/types/excalidraw/fonts/Excalifont/index.d.ts +2 -2
  307. package/types/excalidraw/fonts/Fonts.d.ts +90 -90
  308. package/types/excalidraw/fonts/Helvetica/index.d.ts +2 -2
  309. package/types/excalidraw/fonts/Liberation/index.d.ts +2 -2
  310. package/types/excalidraw/fonts/Lilita/index.d.ts +2 -2
  311. package/types/excalidraw/fonts/Nunito/index.d.ts +2 -2
  312. package/types/excalidraw/fonts/Virgil/index.d.ts +2 -2
  313. package/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -8
  314. package/types/excalidraw/fonts/index.d.ts +1 -1
  315. package/types/excalidraw/gesture.d.ts +6 -6
  316. package/types/excalidraw/history.d.ts +32 -40
  317. package/types/excalidraw/hooks/useCallbackRefState.d.ts +1 -1
  318. package/types/excalidraw/hooks/useCopiedIndicator.d.ts +5 -5
  319. package/types/excalidraw/hooks/useCreatePortalContainer.d.ts +7 -7
  320. package/types/excalidraw/hooks/useEmitter.d.ts +2 -2
  321. package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +11 -11
  322. package/types/excalidraw/hooks/useOutsideClick.d.ts +19 -19
  323. package/types/excalidraw/hooks/useScrollPosition.d.ts +1 -1
  324. package/types/excalidraw/hooks/useStable.d.ts +1 -1
  325. package/types/excalidraw/hooks/useStableCallback.d.ts +4 -4
  326. package/types/excalidraw/hooks/useTransition.d.ts +2 -2
  327. package/types/excalidraw/i18n.d.ts +24 -24
  328. package/types/excalidraw/index-node.d.ts +1 -1
  329. package/types/excalidraw/index.d.ts +59 -59
  330. package/types/excalidraw/laser-trails.d.ts +20 -20
  331. package/types/excalidraw/lasso/index.d.ts +15 -15
  332. package/types/excalidraw/lasso/utils.d.ts +12 -12
  333. package/types/excalidraw/main.d.ts +2 -2
  334. package/types/excalidraw/mermaid.d.ts +2 -2
  335. package/types/excalidraw/obsidianUtils.d.ts +29 -29
  336. package/types/excalidraw/polyfill.d.ts +2 -2
  337. package/types/excalidraw/publicPath.d.ts +1 -1
  338. package/types/excalidraw/reactUtils.d.ts +14 -14
  339. package/types/excalidraw/renderer/helpers.d.ts +18 -13
  340. package/types/excalidraw/renderer/interactiveScene.d.ts +20 -20
  341. package/types/excalidraw/renderer/renderNewElementScene.d.ts +7 -7
  342. package/types/excalidraw/renderer/renderSnaps.d.ts +2 -2
  343. package/types/excalidraw/renderer/roundRect.d.ts +11 -11
  344. package/types/excalidraw/renderer/staticScene.d.ts +11 -11
  345. package/types/excalidraw/renderer/staticSvgScene.d.ts +5 -5
  346. package/types/excalidraw/scene/Renderer.d.ts +28 -28
  347. package/types/excalidraw/scene/export.d.ts +37 -37
  348. package/types/excalidraw/scene/index.d.ts +4 -4
  349. package/types/excalidraw/scene/normalize.d.ts +4 -4
  350. package/types/excalidraw/scene/scroll.d.ts +23 -23
  351. package/types/excalidraw/scene/scrollbars.d.ts +11 -11
  352. package/types/excalidraw/scene/types.d.ts +122 -122
  353. package/types/excalidraw/scene/zoom.d.ts +12 -12
  354. package/types/excalidraw/snapping.d.ts +111 -111
  355. package/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -45
  356. package/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -13
  357. package/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -2
  358. package/types/excalidraw/subset/subset-main.d.ts +12 -12
  359. package/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -32
  360. package/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -15
  361. package/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -31
  362. package/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -14
  363. package/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -2
  364. package/types/excalidraw/types.d.ts +767 -764
  365. package/types/excalidraw/visualdebug.d.ts +41 -41
  366. package/types/excalidraw/webpack.dev.config.d.ts +114 -114
  367. package/types/excalidraw/webpack.prod.config.d.ts +128 -128
  368. package/types/excalidraw/workers.d.ts +36 -36
  369. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +24 -22
  370. package/types/math/src/angle.d.ts +17 -17
  371. package/types/math/src/curve.d.ts +42 -40
  372. package/types/math/src/ellipse.d.ts +44 -44
  373. package/types/math/src/index.d.ts +12 -12
  374. package/types/math/src/line.d.ts +17 -17
  375. package/types/math/src/point.d.ts +122 -122
  376. package/types/math/src/polygon.d.ts +6 -6
  377. package/types/math/src/range.d.ts +44 -44
  378. package/types/math/src/rectangle.d.ts +3 -3
  379. package/types/math/src/segment.d.ts +39 -39
  380. package/types/math/src/triangle.d.ts +11 -11
  381. package/types/math/src/types.d.ts +106 -106
  382. package/types/math/src/utils.d.ts +7 -7
  383. package/types/math/src/vector.d.ts +92 -88
  384. package/types/utils/src/bbox.d.ts +9 -9
  385. package/types/utils/src/collision.d.ts +8 -8
  386. package/types/utils/src/export.d.ts +35 -35
  387. package/types/utils/src/index.d.ts +4 -4
  388. package/types/utils/src/shape.d.ts +58 -58
  389. package/types/utils/src/withinBounds.d.ts +19 -19
  390. package/types/excalidraw/store.d.ts +0 -129
@@ -1,764 +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
- };
609
- export type PointerDownState = Readonly<{
610
- origin: Readonly<{
611
- x: number;
612
- y: number;
613
- }>;
614
- originInGrid: Readonly<{
615
- x: number;
616
- y: number;
617
- }>;
618
- scrollbars: ReturnType<typeof isOverScrollBars>;
619
- lastCoords: {
620
- x: number;
621
- y: number;
622
- };
623
- originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
624
- resize: {
625
- handleType: MaybeTransformHandleType;
626
- isResizing: boolean;
627
- offset: {
628
- x: number;
629
- y: number;
630
- };
631
- arrowDirection: "origin" | "end";
632
- center: {
633
- x: number;
634
- y: number;
635
- };
636
- };
637
- hit: {
638
- element: NonDeleted<ExcalidrawElement> | null;
639
- allHitElements: NonDeleted<ExcalidrawElement>[];
640
- wasAddedToSelection: boolean;
641
- hasBeenDuplicated: boolean;
642
- hasHitCommonBoundingBoxOfSelectedElements: boolean;
643
- };
644
- withCmdOrCtrl: boolean;
645
- drag: {
646
- hasOccurred: boolean;
647
- offset: {
648
- x: number;
649
- y: number;
650
- } | null;
651
- origin: {
652
- x: number;
653
- y: number;
654
- };
655
- };
656
- eventListeners: {
657
- onMove: null | ReturnType<typeof throttleRAF>;
658
- onUp: null | ((event: PointerEvent) => void);
659
- onKeyDown: null | ((event: KeyboardEvent) => void);
660
- onKeyUp: null | ((event: KeyboardEvent) => void);
661
- };
662
- boxSelection: {
663
- hasOccurred: boolean;
664
- };
665
- }>;
666
- export type UnsubscribeCallback = () => void;
667
- export interface ExcalidrawImperativeAPI {
668
- updateScene: InstanceType<typeof App>["updateScene"];
669
- mutateElement: InstanceType<typeof App>["mutateElement"];
670
- updateLibrary: InstanceType<typeof Library>["updateLibrary"];
671
- resetScene: InstanceType<typeof App>["resetScene"];
672
- getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
673
- history: {
674
- clear: InstanceType<typeof App>["resetHistory"];
675
- };
676
- setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
677
- zoomToFit: InstanceType<typeof App>["zoomToFit"];
678
- getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
679
- startLineEditor: InstanceType<typeof App>["startLineEditor"];
680
- getSceneElements: InstanceType<typeof App>["getSceneElements"];
681
- getAppState: () => InstanceType<typeof App>["state"];
682
- getFiles: () => InstanceType<typeof App>["files"];
683
- getName: InstanceType<typeof App>["getName"];
684
- scrollToContent: InstanceType<typeof App>["scrollToContent"];
685
- registerAction: (action: Action) => void;
686
- refresh: InstanceType<typeof App>["refresh"];
687
- setToast: InstanceType<typeof App>["setToast"];
688
- addFiles: (data: BinaryFileData[]) => void;
689
- updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
690
- id: string;
691
- selectElements: (elements: readonly ExcalidrawElement[], highlightSearchResult?: boolean) => void;
692
- sendBackward: (elements: readonly ExcalidrawElement[]) => void;
693
- bringForward: (elements: readonly ExcalidrawElement[]) => void;
694
- sendToBack: (elements: readonly ExcalidrawElement[]) => void;
695
- bringToFront: (elements: readonly ExcalidrawElement[]) => void;
696
- setMobileModeAllowed: (allow: boolean) => void;
697
- setActiveTool: InstanceType<typeof App>["setActiveTool"];
698
- setCursor: InstanceType<typeof App>["setCursor"];
699
- resetCursor: InstanceType<typeof App>["resetCursor"];
700
- toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
701
- getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
702
- /**
703
- * Disables rendering of frames (including element clipping), but currently
704
- * the frames are still interactive in edit mode. As such, this API should be
705
- * used in conjunction with view mode (props.viewModeEnabled).
706
- */
707
- updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
708
- onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
709
- onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
710
- onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
711
- onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
712
- onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
713
- }
714
- export type Device = Readonly<{
715
- viewport: {
716
- isMobile: boolean;
717
- isLandscape: boolean;
718
- };
719
- editor: {
720
- isMobile: boolean;
721
- canFitSidebar: boolean;
722
- };
723
- isTouchScreen: boolean;
724
- }>;
725
- export type FrameNameBounds = {
726
- x: number;
727
- y: number;
728
- width: number;
729
- height: number;
730
- angle: number;
731
- };
732
- export type FrameNameBoundsCache = {
733
- get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
734
- _cache: Map<string, FrameNameBounds & {
735
- zoom: AppState["zoom"]["value"];
736
- versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
737
- }>;
738
- };
739
- export type KeyboardModifiersObject = {
740
- ctrlKey: boolean;
741
- shiftKey: boolean;
742
- altKey: boolean;
743
- metaKey: boolean;
744
- };
745
- export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
746
- export type JSONValue = string | number | boolean | null | object;
747
- export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
748
- export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
749
- export type PendingExcalidrawElements = ExcalidrawElement[];
750
- /** Runtime gridSize value. Null indicates disabled grid. */
751
- export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
752
- export type GenerateDiagramToCode = (props: {
753
- frame: ExcalidrawMagicFrameElement;
754
- children: readonly ExcalidrawElement[];
755
- }) => MaybePromise<{
756
- html: string;
757
- }>;
758
- export type Offsets = Partial<{
759
- top: number;
760
- right: number;
761
- bottom: number;
762
- left: number;
763
- }>;
764
- 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 {};