@zsviczian/excalidraw 0.17.1-obsidian-46 → 0.17.1-obsidian-48

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