@miragari/mivo-math 0.18.1-mivo.0

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 (413) hide show
  1. package/LICENSE +21 -0
  2. package/dist/dev/index.js +938 -0
  3. package/dist/dev/index.js.map +7 -0
  4. package/dist/prod/index.js +1 -0
  5. package/dist/types/common/debug.d.ts +21 -0
  6. package/dist/types/common/src/appEventBus.d.ts +27 -0
  7. package/dist/types/common/src/binary-heap.d.ts +12 -0
  8. package/dist/types/common/src/bounds.d.ts +10 -0
  9. package/dist/types/common/src/colors.d.ts +82 -0
  10. package/dist/types/common/src/constants.d.ts +357 -0
  11. package/dist/types/common/src/editorInterface.d.ts +34 -0
  12. package/dist/types/common/src/emitter.d.ts +16 -0
  13. package/dist/types/common/src/font-metadata.d.ts +46 -0
  14. package/dist/types/common/src/index.d.ts +17 -0
  15. package/dist/types/common/src/keys.d.ts +189 -0
  16. package/dist/types/common/src/points.d.ts +9 -0
  17. package/dist/types/common/src/promise-pool.d.ts +6 -0
  18. package/dist/types/common/src/queue.d.ts +9 -0
  19. package/dist/types/common/src/random.d.ts +3 -0
  20. package/dist/types/common/src/url.d.ts +7 -0
  21. package/dist/types/common/src/utility-types.d.ts +37 -0
  22. package/dist/types/common/src/utils.d.ts +237 -0
  23. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  24. package/dist/types/element/src/Scene.d.ts +84 -0
  25. package/dist/types/element/src/align.d.ts +8 -0
  26. package/dist/types/element/src/arrowheads.d.ts +3 -0
  27. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  28. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  29. package/dist/types/element/src/binding.d.ts +131 -0
  30. package/dist/types/element/src/bounds.d.ts +96 -0
  31. package/dist/types/element/src/collision.d.ts +37 -0
  32. package/dist/types/element/src/comparisons.d.ts +9 -0
  33. package/dist/types/element/src/containerCache.d.ts +11 -0
  34. package/dist/types/element/src/cropElement.d.ts +19 -0
  35. package/dist/types/element/src/delta.d.ts +228 -0
  36. package/dist/types/element/src/distance.d.ts +3 -0
  37. package/dist/types/element/src/distribute.d.ts +8 -0
  38. package/dist/types/element/src/dragElements.d.ts +33 -0
  39. package/dist/types/element/src/duplicate.d.ts +64 -0
  40. package/dist/types/element/src/elbowArrow.d.ts +19 -0
  41. package/dist/types/element/src/elementLink.d.ts +13 -0
  42. package/dist/types/element/src/embeddable.d.ts +10 -0
  43. package/dist/types/element/src/flowchart.d.ts +26 -0
  44. package/dist/types/element/src/fractionalIndex.d.ts +57 -0
  45. package/dist/types/element/src/frame.d.ts +75 -0
  46. package/dist/types/element/src/groups.d.ts +34 -0
  47. package/dist/types/element/src/heading.d.ts +16 -0
  48. package/dist/types/element/src/image.d.ts +22 -0
  49. package/dist/types/element/src/index.d.ts +59 -0
  50. package/dist/types/element/src/linearElementEditor.d.ts +118 -0
  51. package/dist/types/element/src/mutateElement.d.ts +25 -0
  52. package/dist/types/element/src/newElement.d.ts +63 -0
  53. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  54. package/dist/types/element/src/renderElement.d.ts +22 -0
  55. package/dist/types/element/src/resizeElements.d.ts +32 -0
  56. package/dist/types/element/src/resizeTest.d.ts +16 -0
  57. package/dist/types/element/src/selection.d.ts +38 -0
  58. package/dist/types/element/src/shape.d.ts +43 -0
  59. package/dist/types/element/src/showSelectedShapeActions.d.ts +3 -0
  60. package/dist/types/element/src/sizeHelpers.d.ts +35 -0
  61. package/dist/types/element/src/sortElements.d.ts +2 -0
  62. package/dist/types/element/src/store.d.ts +237 -0
  63. package/dist/types/element/src/textElement.d.ts +40 -0
  64. package/dist/types/element/src/textMeasurements.d.ts +39 -0
  65. package/dist/types/element/src/textWrapping.d.ts +39 -0
  66. package/dist/types/element/src/transform.d.ts +81 -0
  67. package/dist/types/element/src/transformHandles.d.ts +36 -0
  68. package/dist/types/element/src/typeChecks.d.ts +55 -0
  69. package/dist/types/element/src/types.d.ts +301 -0
  70. package/dist/types/element/src/utils.d.ts +36 -0
  71. package/dist/types/element/src/zindex.d.ts +13 -0
  72. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +491 -0
  73. package/dist/types/excalidraw/actions/actionAlign.d.ts +109 -0
  74. package/dist/types/excalidraw/actions/actionBoundText.d.ts +364 -0
  75. package/dist/types/excalidraw/actions/actionCanvas.d.ts +1237 -0
  76. package/dist/types/excalidraw/actions/actionClipboard.d.ts +403 -0
  77. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +176 -0
  78. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +527 -0
  79. package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
  80. package/dist/types/excalidraw/actions/actionDistribute.d.ts +33 -0
  81. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +17 -0
  82. package/dist/types/excalidraw/actions/actionElementLink.d.ts +192 -0
  83. package/dist/types/excalidraw/actions/actionElementLock.d.ts +350 -0
  84. package/dist/types/excalidraw/actions/actionExport.d.ts +411 -0
  85. package/dist/types/excalidraw/actions/actionFinalize.d.ts +13 -0
  86. package/dist/types/excalidraw/actions/actionFlip.d.ts +34 -0
  87. package/dist/types/excalidraw/actions/actionFrame.d.ts +984 -0
  88. package/dist/types/excalidraw/actions/actionGroup.d.ts +354 -0
  89. package/dist/types/excalidraw/actions/actionHistory.d.ts +6 -0
  90. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +664 -0
  91. package/dist/types/excalidraw/actions/actionLink.d.ts +177 -0
  92. package/dist/types/excalidraw/actions/actionMenu.d.ts +161 -0
  93. package/dist/types/excalidraw/actions/actionNavigate.d.ts +20 -0
  94. package/dist/types/excalidraw/actions/actionProperties.d.ts +415 -0
  95. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +172 -0
  96. package/dist/types/excalidraw/actions/actionStyles.d.ts +191 -0
  97. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
  98. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
  99. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +178 -0
  100. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
  101. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +177 -0
  102. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +163 -0
  103. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  104. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +176 -0
  105. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +177 -0
  106. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +177 -0
  107. package/dist/types/excalidraw/actions/actionZindex.d.ts +74 -0
  108. package/dist/types/excalidraw/actions/index.d.ts +30 -0
  109. package/dist/types/excalidraw/actions/manager.d.ts +21 -0
  110. package/dist/types/excalidraw/actions/register.d.ts +5 -0
  111. package/dist/types/excalidraw/actions/shortcuts.d.ts +4 -0
  112. package/dist/types/excalidraw/actions/types.d.ts +51 -0
  113. package/dist/types/excalidraw/analytics.d.ts +1 -0
  114. package/dist/types/excalidraw/animatedTrail.d.ts +40 -0
  115. package/dist/types/excalidraw/appState.d.ts +105 -0
  116. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  117. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  118. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  119. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  120. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  121. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  122. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  123. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  124. package/dist/types/excalidraw/clients.d.ts +14 -0
  125. package/dist/types/excalidraw/clipboard.d.ts +104 -0
  126. package/dist/types/excalidraw/components/Actions.d.ts +52 -0
  127. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +4 -0
  128. package/dist/types/excalidraw/components/App.d.ts +723 -0
  129. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  130. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  131. package/dist/types/excalidraw/components/Avatar.d.ts +11 -0
  132. package/dist/types/excalidraw/components/BraveMeasureTextError.d.ts +2 -0
  133. package/dist/types/excalidraw/components/Button.d.ts +17 -0
  134. package/dist/types/excalidraw/components/ButtonSeparator.d.ts +1 -0
  135. package/dist/types/excalidraw/components/Card.d.ts +5 -0
  136. package/dist/types/excalidraw/components/CheckboxItem.d.ts +8 -0
  137. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +8 -0
  138. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +22 -0
  139. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +8 -0
  140. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +7 -0
  141. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +19 -0
  142. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -0
  143. package/dist/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +5 -0
  144. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +9 -0
  145. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +9 -0
  146. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +20 -0
  147. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
  148. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +19 -0
  149. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -0
  150. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +24 -0
  151. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +10 -0
  152. package/dist/types/excalidraw/components/ContextMenu.d.ts +16 -0
  153. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  154. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  155. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +7 -0
  156. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +27 -0
  157. package/dist/types/excalidraw/components/Dialog.d.ts +13 -0
  158. package/dist/types/excalidraw/components/DialogActionButton.d.ts +10 -0
  159. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +7 -0
  160. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +12 -0
  161. package/dist/types/excalidraw/components/Ellipsify.d.ts +3 -0
  162. package/dist/types/excalidraw/components/ErrorDialog.d.ts +5 -0
  163. package/dist/types/excalidraw/components/EyeDropper.d.ts +27 -0
  164. package/dist/types/excalidraw/components/FilledButton.d.ts +19 -0
  165. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +9 -0
  166. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +10 -0
  167. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +22 -0
  168. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +26 -0
  169. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +8 -0
  170. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +13 -0
  171. package/dist/types/excalidraw/components/HelpButton.d.ts +7 -0
  172. package/dist/types/excalidraw/components/HelpDialog.d.ts +4 -0
  173. package/dist/types/excalidraw/components/HintViewer.d.ts +11 -0
  174. package/dist/types/excalidraw/components/IconButton.d.ts +46 -0
  175. package/dist/types/excalidraw/components/IconPicker.d.ts +20 -0
  176. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +14 -0
  177. package/dist/types/excalidraw/components/InlineIcon.d.ts +5 -0
  178. package/dist/types/excalidraw/components/Island.d.ts +17 -0
  179. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +15 -0
  180. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +8 -0
  181. package/dist/types/excalidraw/components/LayerUI.d.ts +32 -0
  182. package/dist/types/excalidraw/components/LibraryMenu.d.ts +10 -0
  183. package/dist/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +7 -0
  184. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +9 -0
  185. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +17 -0
  186. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +14 -0
  187. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +23 -0
  188. package/dist/types/excalidraw/components/LibraryUnit.d.ts +14 -0
  189. package/dist/types/excalidraw/components/LoadingMessage.d.ts +5 -0
  190. package/dist/types/excalidraw/components/LockButton.d.ts +8 -0
  191. package/dist/types/excalidraw/components/MagicButton.d.ts +8 -0
  192. package/dist/types/excalidraw/components/MobileMenu.d.ts +23 -0
  193. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  194. package/dist/types/excalidraw/components/Modal.d.ts +11 -0
  195. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  196. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  197. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  198. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +7 -0
  199. package/dist/types/excalidraw/components/PenModeButton.d.ts +9 -0
  200. package/dist/types/excalidraw/components/Popover.d.ts +16 -0
  201. package/dist/types/excalidraw/components/ProjectName.d.ts +10 -0
  202. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +16 -0
  203. package/dist/types/excalidraw/components/PublishLibrary.d.ts +16 -0
  204. package/dist/types/excalidraw/components/QuickSearch.d.ts +9 -0
  205. package/dist/types/excalidraw/components/RadioButton.d.ts +13 -0
  206. package/dist/types/excalidraw/components/RadioGroup.d.ts +13 -0
  207. package/dist/types/excalidraw/components/RadioSelection.d.ts +20 -0
  208. package/dist/types/excalidraw/components/Range.d.ts +14 -0
  209. package/dist/types/excalidraw/components/SVGLayer.d.ts +7 -0
  210. package/dist/types/excalidraw/components/ScrollableList.d.ts +8 -0
  211. package/dist/types/excalidraw/components/SearchMenu.d.ts +5 -0
  212. package/dist/types/excalidraw/components/Section.d.ts +6 -0
  213. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +70 -0
  214. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +7 -0
  215. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +8 -0
  216. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
  217. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
  218. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +6 -0
  219. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +6 -0
  220. package/dist/types/excalidraw/components/Sidebar/common.d.ts +34 -0
  221. package/dist/types/excalidraw/components/Spinner.d.ts +8 -0
  222. package/dist/types/excalidraw/components/Stack.d.ts +15 -0
  223. package/dist/types/excalidraw/components/Stats/Angle.d.ts +11 -0
  224. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +10 -0
  225. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +10 -0
  226. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +11 -0
  227. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +44 -0
  228. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +11 -0
  229. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +11 -0
  230. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +14 -0
  231. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +12 -0
  232. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +14 -0
  233. package/dist/types/excalidraw/components/Stats/Position.d.ts +12 -0
  234. package/dist/types/excalidraw/components/Stats/index.d.ts +35 -0
  235. package/dist/types/excalidraw/components/Stats/utils.d.ts +19 -0
  236. package/dist/types/excalidraw/components/Switch.d.ts +9 -0
  237. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  238. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  239. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  240. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  241. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  242. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  243. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  244. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +7 -0
  245. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  246. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +13 -0
  247. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +9 -0
  248. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +11 -0
  249. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +21 -0
  250. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
  251. package/dist/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -0
  252. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +7 -0
  253. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -0
  254. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -0
  255. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +11 -0
  256. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  257. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  258. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  259. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +33 -0
  260. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  261. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  262. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  263. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  264. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  265. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  266. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  267. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  268. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  269. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  270. package/dist/types/excalidraw/components/TextField.d.ts +22 -0
  271. package/dist/types/excalidraw/components/Toast.d.ts +13 -0
  272. package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
  273. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  274. package/dist/types/excalidraw/components/Tools.d.ts +128 -0
  275. package/dist/types/excalidraw/components/Tooltip.d.ts +18 -0
  276. package/dist/types/excalidraw/components/Trans.d.ts +9 -0
  277. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  278. package/dist/types/excalidraw/components/UserList.d.ts +18 -0
  279. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +36 -0
  280. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +15 -0
  281. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +19 -0
  282. package/dist/types/excalidraw/components/canvases/index.d.ts +3 -0
  283. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +98 -0
  284. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +17 -0
  285. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  286. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +37 -0
  287. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  288. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +9 -0
  289. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +18 -0
  290. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
  291. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +16 -0
  292. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  293. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  294. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  295. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  296. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
  297. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +6 -0
  298. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +5 -0
  299. package/dist/types/excalidraw/components/footer/Footer.d.ts +13 -0
  300. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +4 -0
  301. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -0
  302. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +10 -0
  303. package/dist/types/excalidraw/components/icons.d.ts +255 -0
  304. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +85 -0
  305. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +87 -0
  306. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +36 -0
  307. package/dist/types/excalidraw/context/tunnels.d.ts +21 -0
  308. package/dist/types/excalidraw/context/ui-appState.d.ts +4 -0
  309. package/dist/types/excalidraw/cursor.d.ts +5 -0
  310. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +8 -0
  311. package/dist/types/excalidraw/data/blob.d.ts +372 -0
  312. package/dist/types/excalidraw/data/encode.d.ts +55 -0
  313. package/dist/types/excalidraw/data/encryption.d.ts +9 -0
  314. package/dist/types/excalidraw/data/filesystem.d.ts +19 -0
  315. package/dist/types/excalidraw/data/image.d.ts +9 -0
  316. package/dist/types/excalidraw/data/index.d.ts +21 -0
  317. package/dist/types/excalidraw/data/json.d.ts +184 -0
  318. package/dist/types/excalidraw/data/library.d.ts +127 -0
  319. package/dist/types/excalidraw/data/resave.d.ts +10 -0
  320. package/dist/types/excalidraw/data/restore.d.ts +41 -0
  321. package/dist/types/excalidraw/data/types.d.ts +48 -0
  322. package/dist/types/excalidraw/deburr.d.ts +1 -0
  323. package/dist/types/excalidraw/editor-jotai.d.ts +56 -0
  324. package/dist/types/excalidraw/eraser/index.d.ts +11 -0
  325. package/dist/types/excalidraw/errors.d.ts +43 -0
  326. package/dist/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
  327. package/dist/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  328. package/dist/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
  329. package/dist/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +25 -0
  330. package/dist/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
  331. package/dist/types/excalidraw/fonts/Fonts.d.ts +79 -0
  332. package/dist/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
  333. package/dist/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
  334. package/dist/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
  335. package/dist/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
  336. package/dist/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
  337. package/dist/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
  338. package/dist/types/excalidraw/fonts/index.d.ts +1 -0
  339. package/dist/types/excalidraw/gesture.d.ts +6 -0
  340. package/dist/types/excalidraw/history.d.ts +48 -0
  341. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  342. package/dist/types/excalidraw/hooks/useCallbackRefState.d.ts +1 -0
  343. package/dist/types/excalidraw/hooks/useCopiedIndicator.d.ts +5 -0
  344. package/dist/types/excalidraw/hooks/useCreatePortalContainer.d.ts +4 -0
  345. package/dist/types/excalidraw/hooks/useEmitter.d.ts +2 -0
  346. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +11 -0
  347. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +21 -0
  348. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -0
  349. package/dist/types/excalidraw/hooks/useStable.d.ts +1 -0
  350. package/dist/types/excalidraw/hooks/useStableCallback.d.ts +4 -0
  351. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  352. package/dist/types/excalidraw/hooks/useTransition.d.ts +2 -0
  353. package/dist/types/excalidraw/i18n.d.ts +24 -0
  354. package/dist/types/excalidraw/laserTrails.d.ts +18 -0
  355. package/dist/types/excalidraw/lasso/index.d.ts +15 -0
  356. package/dist/types/excalidraw/lasso/utils.d.ts +13 -0
  357. package/dist/types/excalidraw/mermaid.d.ts +2 -0
  358. package/dist/types/excalidraw/reactUtils.d.ts +14 -0
  359. package/dist/types/excalidraw/renderer/animation.d.ts +16 -0
  360. package/dist/types/excalidraw/renderer/helpers.d.ts +16 -0
  361. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +12 -0
  362. package/dist/types/excalidraw/renderer/renderNewElementScene.d.ts +7 -0
  363. package/dist/types/excalidraw/renderer/renderSnaps.d.ts +2 -0
  364. package/dist/types/excalidraw/renderer/roundRect.d.ts +11 -0
  365. package/dist/types/excalidraw/renderer/staticScene.d.ts +14 -0
  366. package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +5 -0
  367. package/dist/types/excalidraw/scene/Renderer.d.ts +437 -0
  368. package/dist/types/excalidraw/scene/export.d.ts +36 -0
  369. package/dist/types/excalidraw/scene/index.d.ts +4 -0
  370. package/dist/types/excalidraw/scene/normalize.d.ts +4 -0
  371. package/dist/types/excalidraw/scene/scrollbars.d.ts +11 -0
  372. package/dist/types/excalidraw/scene/types.d.ts +138 -0
  373. package/dist/types/excalidraw/scene/zoom.d.ts +12 -0
  374. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  375. package/dist/types/excalidraw/snapping.d.ts +111 -0
  376. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
  377. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
  378. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
  379. package/dist/types/excalidraw/subset/subset-main.d.ts +12 -0
  380. package/dist/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
  381. package/dist/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
  382. package/dist/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
  383. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
  384. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
  385. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  386. package/dist/types/excalidraw/types.d.ts +1052 -0
  387. package/dist/types/excalidraw/viewport.d.ts +316 -0
  388. package/dist/types/excalidraw/workers.d.ts +36 -0
  389. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +27 -0
  390. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  391. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  392. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  393. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  394. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  395. package/dist/types/math/src/angle.d.ts +19 -0
  396. package/dist/types/math/src/constants.d.ts +2 -0
  397. package/dist/types/math/src/curve.d.ts +77 -0
  398. package/dist/types/math/src/ellipse.d.ts +44 -0
  399. package/dist/types/math/src/index.d.ts +13 -0
  400. package/dist/types/math/src/line.d.ts +17 -0
  401. package/dist/types/math/src/point.d.ts +128 -0
  402. package/dist/types/math/src/polygon.d.ts +6 -0
  403. package/dist/types/math/src/range.d.ts +42 -0
  404. package/dist/types/math/src/rectangle.d.ts +5 -0
  405. package/dist/types/math/src/segment.d.ts +40 -0
  406. package/dist/types/math/src/triangle.d.ts +11 -0
  407. package/dist/types/math/src/types.d.ts +130 -0
  408. package/dist/types/math/src/utils.d.ts +7 -0
  409. package/dist/types/math/src/vector.d.ts +94 -0
  410. package/dist/types/utils/src/export.d.ts +35 -0
  411. package/dist/types/utils/src/index.d.ts +3 -0
  412. package/dist/types/utils/src/shape.d.ts +58 -0
  413. package/package.json +67 -0
@@ -0,0 +1,1052 @@
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface, StrokeWidthKey } from "@excalidraw/common";
2
+ import type { LinearElementEditor } from "@excalidraw/element";
3
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode, ExcalidrawTextElement, StrokeVariability } from "@excalidraw/element/types";
5
+ import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
+ import type { GlobalPoint } from "@excalidraw/math";
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 { ContextMenuItems } from "./components/ContextMenu";
14
+ import type { SnapLine } from "./snapping";
15
+ import type { ImportedDataState } from "./data/types";
16
+ import type { SetViewportOptions } from "./viewport";
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 { App };
22
+ export type SocketId = string & {
23
+ _brand: "SocketId";
24
+ };
25
+ export type Collaborator = Readonly<{
26
+ pointer?: CollaboratorPointer;
27
+ button?: "up" | "down";
28
+ selectedElementIds?: AppState["selectedElementIds"];
29
+ username?: string | null;
30
+ userState?: UserIdleState;
31
+ color?: {
32
+ background: string;
33
+ stroke: string;
34
+ };
35
+ avatarUrl?: string;
36
+ id?: string;
37
+ socketId?: SocketId;
38
+ isCurrentUser?: boolean;
39
+ isInCall?: boolean;
40
+ isSpeaking?: boolean;
41
+ isMuted?: boolean;
42
+ }>;
43
+ export type CollaboratorPointer = {
44
+ x: number;
45
+ y: number;
46
+ tool: "pointer" | "laser";
47
+ /**
48
+ * Whether to render cursor + username. Useful when you only want to render
49
+ * laser trail.
50
+ *
51
+ * @default true
52
+ */
53
+ renderCursor?: boolean;
54
+ /**
55
+ * Explicit laser color.
56
+ *
57
+ * @default string collaborator's cursor color
58
+ */
59
+ laserColor?: string;
60
+ };
61
+ export type DataURL = string & {
62
+ _brand: "DataURL";
63
+ };
64
+ export type BinaryFileData = {
65
+ mimeType: ValueOf<typeof IMAGE_MIME_TYPES> | typeof MIME_TYPES.binary;
66
+ id: FileId;
67
+ dataURL: DataURL;
68
+ /**
69
+ * Epoch timestamp in milliseconds
70
+ */
71
+ created: number;
72
+ /**
73
+ * Indicates when the file was last retrieved from storage to be loaded
74
+ * onto the scene. We use this flag to determine whether to delete unused
75
+ * files from storage.
76
+ *
77
+ * Epoch timestamp in milliseconds.
78
+ */
79
+ lastRetrieved?: number;
80
+ /**
81
+ * indicates the version of the file. This can be used to determine whether
82
+ * the file dataURL has changed e.g. as part of restore due to schema update.
83
+ */
84
+ version?: number;
85
+ };
86
+ export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
87
+ export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
88
+ export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
89
+ export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
90
+ export type ActiveTool = {
91
+ type: ToolType;
92
+ customType: null;
93
+ } | {
94
+ type: "custom";
95
+ customType: string;
96
+ };
97
+ export type SidebarName = string;
98
+ export type SidebarTabName = string;
99
+ export type UserToFollow = {
100
+ socketId: SocketId;
101
+ username: string;
102
+ };
103
+ type _CommonCanvasAppState = {
104
+ zoom: AppState["zoom"];
105
+ scrollX: AppState["scrollX"];
106
+ scrollY: AppState["scrollY"];
107
+ width: AppState["width"];
108
+ height: AppState["height"];
109
+ viewModeEnabled: AppState["viewModeEnabled"];
110
+ openDialog: AppState["openDialog"];
111
+ editingGroupId: AppState["editingGroupId"];
112
+ selectedElementIds: AppState["selectedElementIds"];
113
+ frameToHighlight: AppState["frameToHighlight"];
114
+ offsetLeft: AppState["offsetLeft"];
115
+ offsetTop: AppState["offsetTop"];
116
+ theme: AppState["theme"];
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
+ currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
128
+ hoveredElementIds: AppState["hoveredElementIds"];
129
+ suggestedBinding: AppState["suggestedBinding"];
130
+ croppingElementId: AppState["croppingElementId"];
131
+ }>;
132
+ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
133
+ activeTool: AppState["activeTool"];
134
+ activeEmbeddable: AppState["activeEmbeddable"];
135
+ selectionElement: AppState["selectionElement"];
136
+ selectedGroupIds: AppState["selectedGroupIds"];
137
+ selectedLinearElement: AppState["selectedLinearElement"];
138
+ multiElement: AppState["multiElement"];
139
+ newElement: AppState["newElement"];
140
+ isBindingEnabled: AppState["isBindingEnabled"];
141
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
142
+ gridModeEnabled: AppState["gridModeEnabled"];
143
+ suggestedBinding: AppState["suggestedBinding"];
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
+ isCropping: AppState["isCropping"];
151
+ croppingElementId: AppState["croppingElementId"];
152
+ searchMatches: AppState["searchMatches"];
153
+ activeLockedId: AppState["activeLockedId"];
154
+ hoveredElementIds: AppState["hoveredElementIds"];
155
+ frameRendering: AppState["frameRendering"];
156
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
157
+ exportScale: AppState["exportScale"];
158
+ currentItemArrowType: AppState["currentItemArrowType"];
159
+ }>;
160
+ export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
161
+ export type ObservedStandaloneAppState = {
162
+ name: AppState["name"];
163
+ viewBackgroundColor: AppState["viewBackgroundColor"];
164
+ };
165
+ export type ObservedElementsAppState = {
166
+ editingGroupId: AppState["editingGroupId"];
167
+ selectedElementIds: AppState["selectedElementIds"];
168
+ selectedGroupIds: AppState["selectedGroupIds"];
169
+ selectedLinearElement: {
170
+ elementId: LinearElementEditor["elementId"];
171
+ isEditing: boolean;
172
+ } | null;
173
+ croppingElementId: AppState["croppingElementId"];
174
+ lockedMultiSelections: AppState["lockedMultiSelections"];
175
+ activeLockedId: AppState["activeLockedId"];
176
+ };
177
+ export type BoxSelectionMode = "contain" | "overlap";
178
+ /**
179
+ * A box, in scene coordinates, that pan & zoom are constrained to.
180
+ *
181
+ * This is a private type. For public API, only use specific properties,
182
+ * needed.
183
+ */
184
+ export type ScrollConstraints = {
185
+ x: number;
186
+ y: number;
187
+ width: number;
188
+ height: number;
189
+ /** when set, panning is constrained so the viewport stays within the box */
190
+ lockScroll: boolean;
191
+ /** when set, the viewport cannot zoom out below `zoom` */
192
+ lockZoom: boolean;
193
+ /**
194
+ * The zoom resolved after the `setViewport` navigation settled.
195
+ */
196
+ zoom: number;
197
+ /**
198
+ * Pixel amount the viewport may overscroll past its resting clamp before
199
+ * snapping back (rubberband). Screen pixels, zoom-independent. Resolved
200
+ * from `lock.overscroll` at the time the lock was installed (`true` →
201
+ * default give, `false` → 0).
202
+ */
203
+ overscroll: number;
204
+ /**
205
+ * Extra scrollable margin around the box (CSS-style), letting the viewport
206
+ * scroll past each box edge to reveal that much empty space. Values are
207
+ * viewport pixels and zoom-independent (a fixed on-screen distance).
208
+ * Resolved from the `offsets` passed to `setViewport` (see
209
+ * {@link ViewportOffsets}) at the time the lock was installed.
210
+ */
211
+ offsets?: Offsets;
212
+ };
213
+ export interface AppState {
214
+ contextMenu: {
215
+ items: ContextMenuItems;
216
+ top: number;
217
+ left: number;
218
+ } | null;
219
+ showWelcomeScreen: boolean;
220
+ isLoading: boolean;
221
+ errorMessage: React.ReactNode;
222
+ activeEmbeddable: {
223
+ element: NonDeletedExcalidrawElement;
224
+ state: "hover" | "active";
225
+ } | null;
226
+ /**
227
+ * for a newly created element
228
+ * - set on pointer down, updated during pointer move, used on pointer up
229
+ */
230
+ newElement: NonDeleted<ExcalidrawNonSelectionElement> | null;
231
+ /**
232
+ * for a single element that's being resized
233
+ * - set on pointer down when it's selected and the active tool is selection
234
+ */
235
+ resizingElement: NonDeletedExcalidrawElement | null;
236
+ /**
237
+ * multiElement is for multi-point linear element that's created by clicking as opposed to dragging
238
+ * - when set and present, the editor will handle linear element creation logic accordingly
239
+ */
240
+ multiElement: NonDeleted<ExcalidrawLinearElement> | null;
241
+ /**
242
+ * decoupled from newElement, dragging selection only creates selectionElement
243
+ * - set on pointer down, updated during pointer move
244
+ */
245
+ selectionElement: NonDeletedExcalidrawElement | null;
246
+ /**
247
+ * tracking current arrow binding editor state (takes into account
248
+ * `bindingPreference` and keyboard modifiers (ctrl/alt)
249
+ */
250
+ isBindingEnabled: boolean;
251
+ /** user box selection preference; defaults to "contain" when unset */
252
+ boxSelectionMode: BoxSelectionMode;
253
+ /** user arrow binding preference */
254
+ bindingPreference: "enabled" | "disabled";
255
+ /** user preference whether arrow snap to midpoints while binding */
256
+ isMidpointSnappingEnabled: boolean;
257
+ /**
258
+ * The bindable element the UI highlights for the user when an arrow is
259
+ * dragged or otherwise its endpoint being close to said element.
260
+ */
261
+ suggestedBinding: {
262
+ element: NonDeleted<ExcalidrawBindableElement>;
263
+ midPoint?: GlobalPoint;
264
+ } | null;
265
+ frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
266
+ frameRendering: {
267
+ enabled: boolean;
268
+ name: boolean;
269
+ outline: boolean;
270
+ clip: boolean;
271
+ };
272
+ /**
273
+ * frame-like element whose name is currently being edited
274
+ */
275
+ editingFrame: ExcalidrawFrameLikeElement["id"] | null;
276
+ elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
277
+ /**
278
+ * set when a new text is created or when an existing text is being edited
279
+ */
280
+ editingTextElement: ExcalidrawTextElement | null;
281
+ activeTool: {
282
+ /**
283
+ * indicates a previous tool we should revert back to if we deselect the
284
+ * currently active tool. At the moment applies to `eraser` and `hand` tool.
285
+ */
286
+ lastActiveTool: ActiveTool | null;
287
+ locked: boolean;
288
+ fromSelection: boolean;
289
+ } & ActiveTool;
290
+ preferredSelectionTool: {
291
+ type: "selection" | "lasso";
292
+ initialized: boolean;
293
+ };
294
+ penMode: boolean;
295
+ penDetected: boolean;
296
+ exportBackground: boolean;
297
+ exportEmbedScene: boolean;
298
+ exportWithDarkMode: boolean;
299
+ exportScale: number;
300
+ currentItemStrokeColor: string;
301
+ currentItemBackgroundColor: string;
302
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
303
+ currentItemStrokeWidthKey: StrokeWidthKey;
304
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
305
+ currentItemRoughness: number;
306
+ currentItemStrokeVariability: StrokeVariability;
307
+ currentItemOpacity: number;
308
+ currentItemFontFamily: FontFamilyValues;
309
+ currentItemFontSize: number;
310
+ currentItemTextAlign: TextAlign;
311
+ currentItemStartArrowhead: Arrowhead | null;
312
+ currentItemEndArrowhead: Arrowhead | null;
313
+ currentHoveredFontFamily: FontFamilyValues | null;
314
+ currentItemRoundness: StrokeRoundness;
315
+ currentItemArrowType: "sharp" | "round" | "elbow";
316
+ viewBackgroundColor: string;
317
+ scrollX: number;
318
+ scrollY: number;
319
+ scrollConstraints: ScrollConstraints | null;
320
+ cursorButton: "up" | "down";
321
+ scrolledOutside: boolean;
322
+ name: string | null;
323
+ isResizing: boolean;
324
+ isRotating: boolean;
325
+ zoom: Zoom;
326
+ openMenu: "canvas" | null;
327
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
328
+ openSidebar: {
329
+ name: SidebarName;
330
+ tab?: SidebarTabName;
331
+ } | null;
332
+ openDialog: null | {
333
+ name: "imageExport" | "help" | "jsonExport";
334
+ } | {
335
+ name: "ttd";
336
+ tab: "text-to-diagram" | "mermaid";
337
+ } | {
338
+ name: "commandPalette";
339
+ } | {
340
+ name: "settings";
341
+ } | {
342
+ name: "elementLinkSelector";
343
+ sourceElementId: ExcalidrawElement["id"];
344
+ } | {
345
+ name: "charts";
346
+ data: Spreadsheet;
347
+ rawText: string;
348
+ };
349
+ /**
350
+ * Reflects user preference for whether the default sidebar should be docked.
351
+ *
352
+ * NOTE this is only a user preference and does not reflect the actual docked
353
+ * state of the sidebar, because the host apps can override this through
354
+ * a DefaultSidebar prop, which is not reflected back to the appState.
355
+ */
356
+ defaultSidebarDockedPreference: boolean;
357
+ lastPointerDownWith: PointerType;
358
+ selectedElementIds: Readonly<{
359
+ [id: string]: true;
360
+ }>;
361
+ hoveredElementIds: Readonly<{
362
+ [id: string]: true;
363
+ }>;
364
+ previousSelectedElementIds: {
365
+ [id: string]: true;
366
+ };
367
+ selectedElementsAreBeingDragged: boolean;
368
+ shouldCacheIgnoreZoom: boolean;
369
+ toast: {
370
+ message: React.ReactNode;
371
+ closable?: boolean;
372
+ duration?: number;
373
+ } | null;
374
+ zenModeEnabled: boolean;
375
+ theme: Theme;
376
+ /** grid cell px size */
377
+ gridSize: number;
378
+ gridStep: number;
379
+ gridModeEnabled: boolean;
380
+ viewModeEnabled: boolean;
381
+ /** top-most selected groups (i.e. does not include nested groups) */
382
+ selectedGroupIds: {
383
+ [groupId: string]: boolean;
384
+ };
385
+ /** group being edited when you drill down to its constituent element
386
+ (e.g. when you double-click on a group's element) */
387
+ editingGroupId: GroupId | null;
388
+ width: number;
389
+ height: number;
390
+ offsetTop: number;
391
+ offsetLeft: number;
392
+ fileHandle: FileSystemFileHandle | null;
393
+ collaborators: Map<SocketId, Collaborator>;
394
+ stats: {
395
+ open: boolean;
396
+ /** bitmap. Use `STATS_PANELS` bit values */
397
+ panels: number;
398
+ };
399
+ showHyperlinkPopup: false | "info" | "editor";
400
+ selectedLinearElement: LinearElementEditor | null;
401
+ snapLines: readonly SnapLine[];
402
+ originSnapOffset: {
403
+ x: number;
404
+ y: number;
405
+ } | null;
406
+ objectsSnapModeEnabled: boolean;
407
+ /** the user's socket id & username who is being followed on the canvas */
408
+ userToFollow: UserToFollow | null;
409
+ /** the socket ids of the users following the current user */
410
+ followedBy: Set<SocketId>;
411
+ /** image cropping */
412
+ isCropping: boolean;
413
+ croppingElementId: ExcalidrawElement["id"] | null;
414
+ /** null if no search matches found / search closed */
415
+ searchMatches: Readonly<{
416
+ focusedId: ExcalidrawElement["id"] | null;
417
+ matches: readonly SearchMatch[];
418
+ }> | null;
419
+ /** the locked element/group that's active and shows unlock popup */
420
+ activeLockedId: string | null;
421
+ lockedMultiSelections: {
422
+ [groupId: string]: true;
423
+ };
424
+ bindMode: BindMode;
425
+ }
426
+ export type SearchMatch = {
427
+ id: string;
428
+ focus: boolean;
429
+ matchedLines: {
430
+ offsetX: number;
431
+ offsetY: number;
432
+ width: number;
433
+ height: number;
434
+ showOnCanvas: boolean;
435
+ }[];
436
+ };
437
+ export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom" | "snapLines" | "originSnapOffset" | "suggestedBinding" | "frameToHighlight" | "elementsToHighlight">;
438
+ export type NormalizedZoomValue = number & {
439
+ _brand: "normalizedZoom";
440
+ };
441
+ export type Zoom = Readonly<{
442
+ value: NormalizedZoomValue;
443
+ }>;
444
+ export type PointerCoords = Readonly<{
445
+ x: number;
446
+ y: number;
447
+ }>;
448
+ export type Gesture = {
449
+ pointers: Map<number, PointerCoords>;
450
+ lastCenter: {
451
+ x: number;
452
+ y: number;
453
+ } | null;
454
+ initialDistance: number | null;
455
+ initialScale: number | null;
456
+ };
457
+ export declare class GestureEvent extends UIEvent {
458
+ readonly rotation: number;
459
+ readonly scale: number;
460
+ }
461
+ /** @deprecated legacy: do not use outside of migration paths */
462
+ export type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
463
+ /** @deprecated legacy: do not use outside of migration paths */
464
+ type LibraryItems_v1 = readonly LibraryItem_v1[];
465
+ /** v2 library item */
466
+ export type LibraryItem = {
467
+ id: string;
468
+ status: "published" | "unpublished";
469
+ elements: readonly NonDeleted<ExcalidrawElement>[];
470
+ /** timestamp in epoch (ms) */
471
+ created: number;
472
+ name?: string;
473
+ error?: string;
474
+ };
475
+ export type LibraryItems = readonly LibraryItem[];
476
+ export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
477
+ export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePromise<LibraryItems_anyVersion | Blob>) | MaybePromise<LibraryItems_anyVersion | Blob>;
478
+ export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
479
+ libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
480
+ }>;
481
+ export type ExcalidrawInitialState = {
482
+ viewport?: Omit<SetViewportOptions, "animation">;
483
+ };
484
+ export type OnUserFollowedPayload = {
485
+ userToFollow: UserToFollow;
486
+ action: "FOLLOW" | "UNFOLLOW";
487
+ };
488
+ export type OnExportProgress = {
489
+ type: "progress";
490
+ message?: React.ReactNode;
491
+ /** 0-1 range */
492
+ progress?: number;
493
+ };
494
+ export type InteractionConfig = {
495
+ /**
496
+ * Interactions that stay enabled while the editor is otherwise
497
+ * non-interactive. Opt-in: anything omitted or `false` is disabled.
498
+ */
499
+ enabled?: {
500
+ /**
501
+ * Element links render their link icon and stay clickable — clicking
502
+ * anywhere on a linked element opens the link, same as in view mode.
503
+ * When disabled, link icons are not rendered at all.
504
+ *
505
+ * @default false
506
+ */
507
+ links?: boolean;
508
+ /**
509
+ * Embeddable & iframe elements stay interactive — hovering & clicking
510
+ * activates them so their content can be used, same as in view mode.
511
+ *
512
+ * @default false
513
+ */
514
+ embeds?: boolean;
515
+ /**
516
+ * Umbrella for all interactive content on canvas — shorthand for
517
+ * enabling `links` & `embeds` (and future interactive content kinds)
518
+ * together. Additive: `interactiveContent: true` enables them
519
+ * regardless of their individual values.
520
+ *
521
+ * @default false
522
+ */
523
+ interactiveContent?: boolean;
524
+ /**
525
+ * Canvas navigation — panning (pointer drag, wheel) and zooming
526
+ * (ctrl/cmd + wheel, pinch, and the canvas zoom & zoom-to-fit shortcuts:
527
+ * ctrl/cmd +/-/0, shift+1/2/3), same as in view mode. Respects
528
+ * `appState.scrollConstraints` if set, so it composes with viewport
529
+ * locking. The rest of the keyboard stays disabled. Note the editor
530
+ * consumes wheel & touch input again when enabled, so the page no
531
+ * longer scrolls over the editor.
532
+ *
533
+ * @default false
534
+ */
535
+ navigation?: boolean;
536
+ /**
537
+ * Whether the browser's own zoom remains available over the editor —
538
+ * ctrl/cmd + wheel, pinch, and (while the editor has focus)
539
+ * ctrl/cmd +/-/0 shortcuts. Prevented by default, mirroring the
540
+ * interactive editor. Regular page scrolling stays available either way.
541
+ * With `navigation` enabled, the zoom input (wheel, pinch, keyboard
542
+ * shortcuts) zooms the canvas instead either way, making this moot.
543
+ *
544
+ * @default false
545
+ */
546
+ browserZoom?: boolean;
547
+ };
548
+ };
549
+ export interface ExcalidrawProps {
550
+ onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
551
+ onThemeChange?: (theme: Theme | "system") => void;
552
+ /**
553
+ * note: only subscribes if the props.onIncrement is defined on initial render
554
+ */
555
+ onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
556
+ initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
557
+ initialState?: ExcalidrawInitialState;
558
+ /**
559
+ * Invoked as soon as the Excalidraw API is available
560
+ * NOTE editor is not yet mounted, and state is not yet initialized
561
+ */
562
+ onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
563
+ /**
564
+ * Invoked once the editor root is mounted.
565
+ */
566
+ onMount?: (payload: ExcalidrawMountPayload) => void;
567
+ /**
568
+ * Invoked when the editor root is unmounted.
569
+ */
570
+ onUnmount?: () => void;
571
+ /**
572
+ * Invoked once the initial scene is loaded.
573
+ */
574
+ onInitialize?: (api: ExcalidrawImperativeAPI) => void;
575
+ isCollaborating?: boolean;
576
+ onPointerUpdate?: (payload: {
577
+ pointer: {
578
+ x: number;
579
+ y: number;
580
+ tool: "pointer" | "laser";
581
+ };
582
+ button: "down" | "up";
583
+ pointersMap: Gesture["pointers"];
584
+ }) => void;
585
+ onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
586
+ /**
587
+ * Called when element(s) are duplicated so you can listen or modify as
588
+ * needed.
589
+ *
590
+ * Called when duplicating via mouse-drag, keyboard, paste, library insert
591
+ * etc.
592
+ *
593
+ * Returned elements will be used in place of the next elements
594
+ * (you should return all elements, including deleted, and not mutate
595
+ * the element if changes are made)
596
+ */
597
+ onDuplicate?: (nextElements: readonly ExcalidrawElement[],
598
+ /** excludes the duplicated elements */
599
+ prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
600
+ renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
601
+ renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
602
+ langCode?: Language["code"];
603
+ viewModeEnabled?: boolean;
604
+ /**
605
+ * Whether the editor accepts user input (pointer, keyboard, wheel, touch,
606
+ * clipboard, drag&drop). When `false`, the scene still renders and reacts
607
+ * to programmatic updates (imperative API), but the user cannot affect it
608
+ * in any way. Implies view mode.
609
+ *
610
+ * Pass a config object to keep specific interactions enabled while the
611
+ * editor is otherwise non-interactive (see `InteractionConfig`):
612
+ *
613
+ * ```tsx
614
+ * <Excalidraw interaction={{ enabled: { links: true } }} />
615
+ * ```
616
+ *
617
+ * @default true
618
+ */
619
+ interaction?: boolean | InteractionConfig;
620
+ /**
621
+ * Whether Excalidraw's default UI is rendered — toolbar, default menus,
622
+ * footer controls, sidebars, and canvas popups. Host UI passed through
623
+ * children (including exported components such as `MainMenu` and `Footer`)
624
+ * or render props continues to render, together with any supporting dialogs
625
+ * it opens.
626
+ *
627
+ * Canvas content (elements, text editing surface, frame names, embeds) still
628
+ * renders, and the editor remains interactive unless `interaction` is set to
629
+ * `false`.
630
+ *
631
+ * NOTE: this is WIP and what default UI is/is not rendered when ui=false
632
+ * may yet change.
633
+ *
634
+ * @default true
635
+ */
636
+ ui?: boolean;
637
+ zenModeEnabled?: boolean;
638
+ gridModeEnabled?: boolean;
639
+ objectsSnapModeEnabled?: boolean;
640
+ libraryReturnUrl?: string;
641
+ theme?: Theme;
642
+ name?: string;
643
+ renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
644
+ UIOptions?: Partial<UIOptions>;
645
+ /**
646
+ * dimensions and size constraints for inserted images
647
+ */
648
+ imageOptions?: ImageOptions;
649
+ detectScroll?: boolean;
650
+ handleKeyboardGlobally?: boolean;
651
+ onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
652
+ autoFocus?: boolean;
653
+ generateIdForFile?: (file: File) => string | Promise<string>;
654
+ generateLinkForSelection?: (id: string, type: "element" | "group") => string;
655
+ onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
656
+ nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
657
+ }>) => void;
658
+ onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
659
+ onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
660
+ onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
661
+ onUserFollow?: (payload: OnUserFollowedPayload) => void;
662
+ children?: React.ReactNode;
663
+ validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
664
+ renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
665
+ aiEnabled?: boolean;
666
+ showDeprecatedFonts?: boolean;
667
+ renderScrollbars?: boolean;
668
+ /**
669
+ * Called before exporting to a file.
670
+ *
671
+ * Allows the host app to intercept and delay saving until async operations
672
+ * (e.g., images are loaded) complete.
673
+ *
674
+ * If Promise/AsyncGenerator is returned, a progress toast will be shown
675
+ * until the operation completes. Generator can yield progress updates.
676
+ */
677
+ onExport?: (
678
+ /** type of export. Currently we only call for JSON exports or
679
+ * JSON-embedded PNG (which is also identified as `json` type here)*/
680
+ type: "json", data: {
681
+ elements: readonly ExcalidrawElement[];
682
+ appState: AppState;
683
+ files: BinaryFiles;
684
+ }, options: {
685
+ /** signal that gets aborted if user cancels the export (e.g. closes
686
+ * the native file picker dialog). In that case, you can either
687
+ * return immediately, or throw AbortError.
688
+ */
689
+ signal: AbortSignal;
690
+ }) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
691
+ }
692
+ export type SceneData = {
693
+ elements?: ImportedDataState["elements"];
694
+ appState?: ImportedDataState["appState"];
695
+ collaborators?: Map<SocketId, Collaborator>;
696
+ captureUpdate?: CaptureUpdateActionType;
697
+ };
698
+ export type ExportOpts = {
699
+ saveFileToDisk?: boolean;
700
+ onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
701
+ renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
702
+ };
703
+ export type ImageOptions = Partial<{
704
+ maxWidthOrHeight: number;
705
+ maxFileSizeBytes: number;
706
+ }>;
707
+ export type CanvasActions = Partial<{
708
+ changeViewBackgroundColor: boolean;
709
+ clearCanvas: boolean;
710
+ export: false | ExportOpts;
711
+ loadScene: boolean;
712
+ saveToActiveFile: boolean;
713
+ /**
714
+ * defaults to true if `props.theme` is omitted or `props.onThemeChange`
715
+ * is supplied (at which point the theme is considered as host-app controlled),
716
+ * else default to false
717
+ * */
718
+ toggleTheme: boolean | null;
719
+ saveAsImage: boolean;
720
+ }>;
721
+ export type UIOptions = Partial<{
722
+ dockedSidebarBreakpoint: number;
723
+ canvasActions: CanvasActions;
724
+ tools: {
725
+ image: boolean;
726
+ };
727
+ /**
728
+ * Optionally control the editor form factor and desktop UI mode from the host app.
729
+ * If not provided, we will take care of it internally.
730
+ */
731
+ getFormFactor?: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
732
+ /** @deprecated does nothing. Will be removed in 0.15 */
733
+ welcomeScreen?: boolean;
734
+ }>;
735
+ export type AppProps = Merge<ExcalidrawProps, {
736
+ UIOptions: Merge<UIOptions, {
737
+ canvasActions: Required<CanvasActions> & {
738
+ export: ExportOpts;
739
+ };
740
+ }>;
741
+ imageOptions: Required<ImageOptions>;
742
+ detectScroll: boolean;
743
+ handleKeyboardGlobally: boolean;
744
+ isCollaborating: boolean;
745
+ children?: React.ReactNode;
746
+ aiEnabled: boolean;
747
+ }>;
748
+ /** A subset of App class properties that we need to use elsewhere
749
+ * in the app, eg Manager. Factored out into a separate type to keep DRY. */
750
+ export type AppClassProperties = {
751
+ props: AppProps;
752
+ state: AppState;
753
+ api: App["api"];
754
+ sessionExportThemeOverride: App["sessionExportThemeOverride"];
755
+ interactiveCanvas: HTMLCanvasElement | null;
756
+ /** static canvas */
757
+ canvas: HTMLCanvasElement;
758
+ focusContainer(): void;
759
+ library: Library;
760
+ imageCache: Map<FileId, {
761
+ image: HTMLImageElement | Promise<HTMLImageElement>;
762
+ mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
763
+ }>;
764
+ files: BinaryFiles;
765
+ editorInterface: App["editorInterface"];
766
+ scene: App["scene"];
767
+ syncActionResult: App["syncActionResult"];
768
+ fonts: App["fonts"];
769
+ pasteFromClipboard: App["pasteFromClipboard"];
770
+ id: App["id"];
771
+ onInsertElements: App["onInsertElements"];
772
+ onExportImage: App["onExportImage"];
773
+ lastViewportPosition: App["lastViewportPosition"];
774
+ setViewport: App["setViewport"];
775
+ addFiles: App["addFiles"];
776
+ addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
777
+ togglePenMode: App["togglePenMode"];
778
+ toggleLock: App["toggleLock"];
779
+ setActiveTool: App["setActiveTool"];
780
+ setOpenDialog: App["setOpenDialog"];
781
+ insertEmbeddableElement: App["insertEmbeddableElement"];
782
+ onMagicframeToolSelect: App["onMagicframeToolSelect"];
783
+ getName: App["getName"];
784
+ dismissLinearEditor: App["dismissLinearEditor"];
785
+ flowchart: App["flowchart"];
786
+ getEffectiveGridSize: App["getEffectiveGridSize"];
787
+ setPlugins: App["setPlugins"];
788
+ plugins: App["plugins"];
789
+ getViewportOffsets: App["getViewportOffsets"];
790
+ visibleElements: App["visibleElements"];
791
+ excalidrawContainerValue: App["excalidrawContainerValue"];
792
+ onPointerUpEmitter: App["onPointerUpEmitter"];
793
+ updateEditorAtom: App["updateEditorAtom"];
794
+ onPointerDownEmitter: App["onPointerDownEmitter"];
795
+ onEvent: App["onEvent"];
796
+ onStateChange: App["onStateChange"];
797
+ lastPointerMoveCoords: App["lastPointerMoveCoords"];
798
+ lastPointerMoveEvent: App["lastPointerMoveEvent"];
799
+ bindModeHandler: App["bindModeHandler"];
800
+ setAppState: App["setAppState"];
801
+ isInteractionEnabled: App["isInteractionEnabled"];
802
+ isNavigationEnabled: App["isNavigationEnabled"];
803
+ };
804
+ export type PointerDownState = Readonly<{
805
+ origin: Readonly<{
806
+ x: number;
807
+ y: number;
808
+ }>;
809
+ originInGrid: Readonly<{
810
+ x: number;
811
+ y: number;
812
+ }>;
813
+ scrollbars: ReturnType<typeof isOverScrollBars>;
814
+ lastCoords: {
815
+ x: number;
816
+ y: number;
817
+ };
818
+ originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
819
+ resize: {
820
+ handleType: MaybeTransformHandleType;
821
+ isResizing: boolean;
822
+ offset: {
823
+ x: number;
824
+ y: number;
825
+ };
826
+ arrowDirection: "origin" | "end";
827
+ center: {
828
+ x: number;
829
+ y: number;
830
+ };
831
+ };
832
+ hit: {
833
+ element: NonDeleted<ExcalidrawElement> | null;
834
+ allHitElements: NonDeleted<ExcalidrawElement>[];
835
+ wasAddedToSelection: boolean;
836
+ hasBeenDuplicated: boolean;
837
+ hasHitCommonBoundingBoxOfSelectedElements: boolean;
838
+ };
839
+ withCmdOrCtrl: boolean;
840
+ drag: {
841
+ hasOccurred: boolean;
842
+ offset: {
843
+ x: number;
844
+ y: number;
845
+ } | null;
846
+ origin: {
847
+ x: number;
848
+ y: number;
849
+ };
850
+ blockDragging: boolean;
851
+ };
852
+ eventListeners: {
853
+ onMove: null | ReturnType<typeof throttleRAF>;
854
+ onUp: null | ((event: PointerEvent) => void);
855
+ onKeyDown: null | ((event: KeyboardEvent) => void);
856
+ onKeyUp: null | ((event: KeyboardEvent) => void);
857
+ };
858
+ boxSelection: {
859
+ hasOccurred: boolean;
860
+ };
861
+ }>;
862
+ export type UnsubscribeCallback = () => void;
863
+ export type ExcalidrawMountPayload = {
864
+ excalidrawAPI: ExcalidrawImperativeAPI;
865
+ container: HTMLDivElement | null;
866
+ };
867
+ export type ExcalidrawImperativeAPIEventMap = {
868
+ "editor:mount": [payload: ExcalidrawMountPayload];
869
+ "editor:initialize": [api: ExcalidrawImperativeAPI];
870
+ "editor:unmount": [];
871
+ };
872
+ export interface ExcalidrawImperativeAPI {
873
+ /** Whether the editor has been unmounted and the API is no longer usable. */
874
+ isDestroyed: boolean;
875
+ updateScene: InstanceType<typeof App>["updateScene"];
876
+ applyDeltas: InstanceType<typeof App>["applyDeltas"];
877
+ mutateElement: InstanceType<typeof App>["mutateElement"];
878
+ updateLibrary: InstanceType<typeof Library>["updateLibrary"];
879
+ resetScene: InstanceType<typeof App>["resetScene"];
880
+ getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
881
+ getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
882
+ history: {
883
+ clear: InstanceType<typeof App>["resetHistory"];
884
+ };
885
+ getSceneElements: InstanceType<typeof App>["getSceneElements"];
886
+ getAppState: () => InstanceType<typeof App>["state"];
887
+ getFiles: () => InstanceType<typeof App>["files"];
888
+ getName: InstanceType<typeof App>["getName"];
889
+ setViewport: InstanceType<typeof App>["setViewport"];
890
+ getViewportOffsets: InstanceType<typeof App>["getViewportOffsets"];
891
+ registerAction: (action: Action) => void;
892
+ refresh: InstanceType<typeof App>["refresh"];
893
+ setToast: InstanceType<typeof App>["setToast"];
894
+ addFiles: (data: BinaryFileData[]) => void;
895
+ id: string;
896
+ setActiveTool: InstanceType<typeof App>["setActiveTool"];
897
+ setCursor: InstanceType<typeof App>["setCursor"];
898
+ resetCursor: InstanceType<typeof App>["resetCursor"];
899
+ toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
900
+ getEditorInterface: () => EditorInterface;
901
+ /**
902
+ * Disables rendering of frames (including element clipping), but currently
903
+ * the frames are still interactive in edit mode. As such, this API should be
904
+ * used in conjunction with view mode (props.viewModeEnabled).
905
+ */
906
+ updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
907
+ onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
908
+ onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
909
+ onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
910
+ onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
911
+ onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
912
+ onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
913
+ onStateChange: InstanceType<typeof App>["onStateChange"];
914
+ onEvent: InstanceType<typeof App>["onEvent"];
915
+ }
916
+ export type FrameNameBounds = {
917
+ x: number;
918
+ y: number;
919
+ width: number;
920
+ height: number;
921
+ };
922
+ export type FrameNameBoundsCache = {
923
+ get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
924
+ _cache: Map<string, FrameNameBounds & {
925
+ zoom: AppState["zoom"]["value"];
926
+ versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
927
+ }>;
928
+ };
929
+ export type KeyboardModifiersObject = {
930
+ ctrlKey: boolean;
931
+ shiftKey: boolean;
932
+ altKey: boolean;
933
+ metaKey: boolean;
934
+ };
935
+ export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
936
+ export type JSONValue = string | number | boolean | null | object;
937
+ export type EmbedsValidationStatus = Map<ExcalidrawIframeLikeElement["id"], boolean>;
938
+ export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
939
+ export type PendingExcalidrawElements = NonDeletedExcalidrawElement[];
940
+ /** Runtime gridSize value. Null indicates disabled grid. */
941
+ export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSize">) | null;
942
+ export type GenerateDiagramToCode = (props: {
943
+ frame: NonDeleted<ExcalidrawMagicFrameElement>;
944
+ children: readonly NonDeletedExcalidrawElement[];
945
+ }) => MaybePromise<{
946
+ html: string;
947
+ }>;
948
+ export type Offsets = Partial<{
949
+ top: number;
950
+ right: number;
951
+ bottom: number;
952
+ left: number;
953
+ }>;
954
+ /**
955
+ * Value of the `data-viewport-ui` attribute, marking a DOM node as a UI
956
+ * surface that occludes the canvas. Such nodes are measured by
957
+ * `getViewportOffsets` to compute the default per-side viewport offsets:
958
+ *
959
+ * - `top` / `bottom` — offsets that side by the node's bottom/top edge
960
+ * - `side` — a panel hugging the left or right edge. Which side is not
961
+ * declared but resolved geometrically: if the node's horizontal center
962
+ * lies in the left half of the viewport it counts against the left
963
+ * offset (by its right edge), otherwise against the right offset (by
964
+ * `viewportWidth - left edge`). Measuring the rendered position instead
965
+ * of declaring a side means RTL layouts and host-configurable docking
966
+ * (e.g. sidebar side) are handled for free — but it assumes the surface
967
+ * actually hugs one edge; don't mark a centered/near-full-width node as
968
+ * `side` (its midpoint would classify it to one side and the offset
969
+ * would swallow most of the viewport).
970
+ *
971
+ * The attribute should only be present while the surface is actually
972
+ * rendered — omit it (don't just hide the node) when the surface shouldn't
973
+ * push the viewport around.
974
+ */
975
+ export type ViewportUIDock = "top" | "bottom" | "side";
976
+ /**
977
+ * Options for `getViewportOffsets` (and the `ui` key of
978
+ * {@link ViewportOffsets}), controlling how offsets are derived from the
979
+ * currently rendered editor UI.
980
+ *
981
+ * NOTE unlike the physical sides of {@link Offsets}, the horizontal values
982
+ * here are logical, i.e. flipped in RTL layouts (`left` refers to the
983
+ * reading-direction start side).
984
+ */
985
+ export type ViewportOffsetsOptions = {
986
+ /** padding added to each measured side (default 24) */
987
+ padding?: number;
988
+ paddingTop?: number;
989
+ paddingRight?: number;
990
+ paddingBottom?: number;
991
+ paddingLeft?: number;
992
+ /** final value for the given side, replacing the measured UI size
993
+ * (padding is not added on top) */
994
+ top?: number;
995
+ bottom?: number;
996
+ left?: number;
997
+ right?: number;
998
+ /**
999
+ * Reserve space for the given conditionally-rendered surfaces even while
1000
+ * they're hidden, so the resulting offsets don't shift when they
1001
+ * (dis)appear. Uses the surface's last-measured footprint, falling back
1002
+ * to an approximate default if it hasn't been rendered yet. Ignored on
1003
+ * phones (where these surfaces never occlude the canvas).
1004
+ */
1005
+ reserve?: {
1006
+ /** styles panel (rendered when a tool or selection is active) */
1007
+ stylesPanel?: boolean;
1008
+ /** sidebar (e.g. library) */
1009
+ sidebar?: boolean;
1010
+ };
1011
+ };
1012
+ /**
1013
+ * Viewport offsets accepted by the `setViewport`-family APIs (`setViewport`,
1014
+ * `props.initialState.viewport`), insetting the usable viewport area per
1015
+ * side so the target isn't fitted/centered underneath overlaid UI.
1016
+ *
1017
+ * Two (combinable) ways to specify:
1018
+ *
1019
+ * - **Static sides** (`top`/`right`/`bottom`/`left`) — absolute pixel
1020
+ * values, used as-is: physical (not flipped in RTL), zoom-independent,
1021
+ * no padding added. Sides not specified default to `0` (unless `ui` is
1022
+ * set, see below).
1023
+ *
1024
+ * - **`ui`** — derive the offsets from the editor UI (toolbar, styles
1025
+ * panel, sidebar...) as rendered at the time the viewport is set,
1026
+ * equivalent to calling `getViewportOffsets()`. Pass `true` for the
1027
+ * defaults, or options ({@link ViewportOffsetsOptions}) to customize
1028
+ * padding or reserve space for currently-hidden surfaces.
1029
+ *
1030
+ * When both are given, a static side always wins for that side — it
1031
+ * replaces whatever `ui` would yield (including `ui`'s own side overrides,
1032
+ * which — unlike the physical static sides — are RTL-relative). The
1033
+ * remaining sides fall back to the `ui`-derived values.
1034
+ *
1035
+ * @example
1036
+ * { top: 40 } // top 40px, other sides 0
1037
+ * { ui: true } // measured UI + default padding
1038
+ * { ui: { reserve: { stylesPanel: true } } } // + keep space for hidden panel
1039
+ * { top: 40, ui: true } // top exactly 40px, rest from UI
1040
+ */
1041
+ export type ViewportOffsets = Offsets & {
1042
+ ui?: true | ViewportOffsetsOptions;
1043
+ };
1044
+ /**
1045
+ * Value of the `data-viewport-ui-name` attribute, identifying a
1046
+ * conditionally-rendered surface (marked with `data-viewport-ui`) so that
1047
+ * `getViewportOffsets` can reserve space for it while it's hidden (see the
1048
+ * `reserve` option). Whenever a named surface is rendered, its measured
1049
+ * footprint is remembered; reserving uses that remembered footprint, or an
1050
+ * approximate default if the surface hasn't been rendered yet.
1051
+ */
1052
+ export type ViewportUIName = "sidebar" | "stylesPanel";