@excalidraw/excalidraw 0.18.0-d92384b77-2 → 0.18.0-f0063e113

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