@excalidraw/common 0.18.0-3bdaafe → 0.18.0-3c916c5

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 (378) hide show
  1. package/dist/dev/index.js +1867 -345
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/appEventBus.d.ts +27 -0
  6. package/dist/types/common/src/bounds.d.ts +10 -0
  7. package/dist/types/common/src/colors.d.ts +81 -39
  8. package/dist/types/common/src/constants.d.ts +103 -35
  9. package/dist/types/common/src/editorInterface.d.ts +34 -0
  10. package/dist/types/common/src/font-metadata.d.ts +1 -3
  11. package/dist/types/common/src/index.d.ts +5 -0
  12. package/dist/types/common/src/keys.d.ts +5 -1
  13. package/dist/types/common/src/points.d.ts +1 -1
  14. package/dist/types/common/src/random.d.ts +7 -0
  15. package/dist/types/common/src/utility-types.d.ts +0 -1
  16. package/dist/types/common/src/utils.d.ts +59 -78
  17. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  18. package/dist/types/element/src/Scene.d.ts +12 -8
  19. package/dist/types/element/src/align.d.ts +5 -2
  20. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  21. package/dist/types/element/src/arrowheads.d.ts +3 -0
  22. package/dist/types/element/src/arrows/focus.d.ts +30 -0
  23. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  24. package/dist/types/element/src/binding.d.ts +145 -49
  25. package/dist/types/element/src/bounds.d.ts +34 -19
  26. package/dist/types/element/src/bucketFill.d.ts +110 -0
  27. package/dist/types/element/src/collision.d.ts +24 -3
  28. package/dist/types/element/src/comparisons.d.ts +10 -7
  29. package/dist/types/element/src/convertToShape.d.ts +23 -0
  30. package/dist/types/element/src/cropElement.d.ts +36 -4
  31. package/dist/types/element/src/delta.d.ts +30 -2
  32. package/dist/types/element/src/distribute.d.ts +6 -2
  33. package/dist/types/element/src/dragElements.d.ts +37 -5
  34. package/dist/types/element/src/duplicate.d.ts +67 -6
  35. package/dist/types/element/src/elbowArrow.d.ts +7 -0
  36. package/dist/types/element/src/embeddable.d.ts +3 -2
  37. package/dist/types/element/src/flowchart.d.ts +9 -11
  38. package/dist/types/element/src/fractionalIndex.d.ts +4 -4
  39. package/dist/types/element/src/frame.d.ts +35 -12
  40. package/dist/types/element/src/groups.d.ts +10 -15
  41. package/dist/types/element/src/heading.d.ts +2 -1
  42. package/dist/types/element/src/image.d.ts +6 -13
  43. package/dist/types/element/src/index.d.ts +11 -4
  44. package/dist/types/element/src/linearElementEditor.d.ts +51 -30
  45. package/dist/types/element/src/listMarker.d.ts +39 -0
  46. package/dist/types/element/src/mutateElement.d.ts +6 -2
  47. package/dist/types/element/src/newElement.d.ts +61 -9
  48. package/dist/types/element/src/renderElement.d.ts +33 -12
  49. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  50. package/dist/types/element/src/resizeElements.d.ts +24 -14
  51. package/dist/types/element/src/resizeTest.d.ts +6 -5
  52. package/dist/types/element/src/selection.d.ts +11 -17
  53. package/dist/types/element/src/shape.d.ts +38 -9
  54. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  55. package/dist/types/element/src/sortElements.d.ts +10 -0
  56. package/dist/types/element/src/stickyNote.d.ts +191 -0
  57. package/dist/types/element/src/textElement.d.ts +23 -11
  58. package/dist/types/element/src/textMeasurements.d.ts +16 -14
  59. package/dist/types/element/src/textWrapping.d.ts +28 -1
  60. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +32 -9
  61. package/dist/types/element/src/transformHandles.d.ts +8 -27
  62. package/dist/types/element/src/typeChecks.d.ts +30 -31
  63. package/dist/types/element/src/types.d.ts +55 -20
  64. package/dist/types/element/src/utils.d.ts +22 -6
  65. package/dist/types/element/src/zindex.d.ts +7 -1
  66. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +248 -219
  67. package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
  68. package/dist/types/excalidraw/actions/actionBoundText.d.ts +116 -272
  69. package/dist/types/excalidraw/actions/actionCanvas.d.ts +578 -1611
  70. package/dist/types/excalidraw/actions/actionClipboard.d.ts +177 -899
  71. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +73 -64
  72. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -562
  73. package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
  74. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
  75. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
  76. package/dist/types/excalidraw/actions/actionElementLink.d.ts +80 -77
  77. package/dist/types/excalidraw/actions/actionElementLock.d.ts +149 -130
  78. package/dist/types/excalidraw/actions/actionExport.d.ts +229 -1415
  79. package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -394
  80. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  81. package/dist/types/excalidraw/actions/actionFrame.d.ts +247 -875
  82. package/dist/types/excalidraw/actions/actionGroup.d.ts +160 -149
  83. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +261 -238
  84. package/dist/types/excalidraw/actions/actionLink.d.ts +86 -77
  85. package/dist/types/excalidraw/actions/actionMenu.d.ts +75 -438
  86. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
  87. package/dist/types/excalidraw/actions/actionProperties.d.ts +238 -2533
  88. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +80 -75
  89. package/dist/types/excalidraw/actions/actionStyles.d.ts +74 -64
  90. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
  91. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +195 -0
  92. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +88 -80
  93. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
  94. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +87 -78
  95. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +76 -74
  96. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
  97. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
  98. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +86 -77
  99. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +87 -78
  100. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  101. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +87 -78
  102. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  103. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  104. package/dist/types/excalidraw/actions/index.d.ts +7 -3
  105. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  106. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  107. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  108. package/dist/types/excalidraw/actions/types.d.ts +11 -7
  109. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  110. package/dist/types/excalidraw/appState.d.ts +66 -35
  111. package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
  112. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  113. package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
  114. package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
  115. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  116. package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
  117. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  118. package/dist/types/excalidraw/charts/index.d.ts +8 -0
  119. package/dist/types/excalidraw/clipboard.d.ts +58 -21
  120. package/dist/types/excalidraw/components/Actions.d.ts +33 -11
  121. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  122. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  123. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  124. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  125. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  126. package/dist/types/excalidraw/components/App.d.ts +415 -154
  127. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  128. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  129. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  130. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  131. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  132. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  133. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  134. package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
  135. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  136. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  137. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  138. package/dist/types/excalidraw/components/App.viewport.d.ts +123 -0
  139. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  140. package/dist/types/excalidraw/components/App.wrap.d.ts +31 -0
  141. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  142. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  143. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  144. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -4
  145. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  146. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +7 -1
  147. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -2
  148. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
  149. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  150. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
  151. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  152. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  153. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  154. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  155. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  156. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +6 -5
  157. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  158. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  159. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  160. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  161. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  162. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  163. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
  164. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  165. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  166. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +5 -1
  167. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  168. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  169. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  170. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  171. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  172. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  173. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  174. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  175. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  176. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  177. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  178. package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
  179. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  180. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  181. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  182. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +7 -3
  183. package/dist/types/excalidraw/components/LibraryUnit.d.ts +9 -5
  184. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  185. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  186. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  187. package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
  188. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  189. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  190. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  191. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  192. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  193. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  194. package/dist/types/excalidraw/components/Popover.d.ts +2 -3
  195. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  196. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  197. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  198. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  199. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  200. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  201. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  202. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  203. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
  204. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  205. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  206. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  207. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  208. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  209. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  210. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  211. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  212. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  213. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  214. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
  215. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  216. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  217. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  218. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  219. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  220. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  221. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  222. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  223. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  224. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  225. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  226. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  227. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  228. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +4 -2
  229. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  230. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  231. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  232. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +9 -3
  233. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  234. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  235. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  236. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  237. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +12 -0
  238. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  239. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +10 -0
  240. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +19 -16
  241. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  242. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  243. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +8 -0
  244. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  245. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +108 -0
  246. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  247. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  248. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  249. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
  250. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  251. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  252. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  253. package/dist/types/excalidraw/components/ToolPopover.d.ts +22 -0
  254. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  255. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  256. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  257. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  258. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  259. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  260. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  261. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  262. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  263. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +9 -4
  264. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
  265. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  266. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  267. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  268. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  269. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  270. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  271. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  272. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  273. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  274. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  275. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  276. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  277. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  278. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  279. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  280. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  281. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  282. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  283. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  284. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +16 -5
  285. package/dist/types/excalidraw/components/icons.d.ts +56 -22
  286. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
  287. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  288. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  289. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  290. package/dist/types/excalidraw/data/blob.d.ts +373 -15
  291. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  292. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  293. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  294. package/dist/types/excalidraw/data/index.d.ts +11 -12
  295. package/dist/types/excalidraw/data/json.d.ts +192 -3
  296. package/dist/types/excalidraw/data/library.d.ts +25 -10
  297. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  298. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  299. package/dist/types/excalidraw/data/types.d.ts +4 -1
  300. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  301. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  302. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  303. package/dist/types/excalidraw/errors.d.ts +14 -0
  304. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  305. package/dist/types/excalidraw/history.d.ts +10 -4
  306. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  307. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
  308. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  309. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  310. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  311. package/dist/types/excalidraw/i18n.d.ts +2 -2
  312. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  313. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  314. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  315. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  316. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  317. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  318. package/dist/types/excalidraw/renderer/animation.d.ts +23 -0
  319. package/dist/types/excalidraw/renderer/helpers.d.ts +31 -8
  320. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
  321. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  322. package/dist/types/excalidraw/scene/Renderer.d.ts +492 -20
  323. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  324. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  325. package/dist/types/excalidraw/scene/types.d.ts +51 -9
  326. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  327. package/dist/types/excalidraw/snapping.d.ts +12 -12
  328. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  329. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  330. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  331. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  332. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  333. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  334. package/dist/types/excalidraw/types.d.ts +697 -61
  335. package/dist/types/excalidraw/viewport.d.ts +302 -0
  336. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +19 -5
  337. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  338. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  339. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  340. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  341. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  342. package/dist/types/math/src/constants.d.ts +0 -1
  343. package/dist/types/math/src/curve.d.ts +23 -13
  344. package/dist/types/math/src/index.d.ts +1 -0
  345. package/dist/types/math/src/pca.d.ts +79 -0
  346. package/dist/types/math/src/point.d.ts +8 -2
  347. package/dist/types/math/src/polygon.d.ts +26 -2
  348. package/dist/types/math/src/range.d.ts +1 -3
  349. package/dist/types/math/src/segment.d.ts +10 -3
  350. package/dist/types/math/src/types.d.ts +25 -1
  351. package/dist/types/utils/src/index.d.ts +4 -3
  352. package/dist/types/utils/src/shape.d.ts +8 -8
  353. package/package.json +7 -1
  354. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -185
  355. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  356. package/dist/types/excalidraw/charts.d.ts +0 -27
  357. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  358. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  359. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  360. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  361. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  362. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  363. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  364. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  365. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  366. package/dist/types/excalidraw/components/shapes.d.ts +0 -190
  367. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  368. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  369. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  370. package/dist/types/excalidraw/cursor.d.ts +0 -5
  371. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  372. package/dist/types/excalidraw/index.d.ts +0 -47
  373. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  374. package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
  375. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  376. package/dist/types/utils/src/bbox.d.ts +0 -9
  377. package/dist/types/utils/src/export.d.ts +0 -35
  378. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,11 +1,200 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { MaybePromise } from "@excalidraw/common/utility-types";
2
3
  import type { AppState, BinaryFiles, LibraryItems } from "../types";
3
4
  import type { ImportedDataState, ImportedLibraryData } from "./types";
5
+ export type JSONExportData = {
6
+ elements: readonly ExcalidrawElement[];
7
+ appState: AppState;
8
+ files: BinaryFiles;
9
+ };
4
10
  export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
5
- export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, name?: string) => Promise<{
6
- fileHandle: import("browser-fs-access").FileSystemHandle | null;
11
+ export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
12
+ data: MaybePromise<JSONExportData>;
13
+ filename: string;
14
+ fileHandle: AppState["fileHandle"];
15
+ }) => Promise<{
16
+ fileHandle: FileSystemFileHandle | null;
17
+ }>;
18
+ export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
19
+ elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
20
+ appState: {
21
+ zoom: import("../types").Zoom;
22
+ viewModeEnabled: boolean;
23
+ activeTool: {
24
+ lastActiveTool: import("../types").ActiveTool | null;
25
+ locked: boolean;
26
+ fromSelection: boolean;
27
+ } & import("../types").ActiveTool;
28
+ zenModeEnabled: boolean;
29
+ gridModeEnabled: boolean;
30
+ objectsSnapModeEnabled: boolean;
31
+ theme: import("@excalidraw/element/types").Theme;
32
+ name: string | null;
33
+ currentItemArrowType: "sharp" | "round" | "elbow";
34
+ gridSize: number;
35
+ scrollX: number;
36
+ scrollY: number;
37
+ contextMenu: {
38
+ items: import("../components/ContextMenu").ContextMenuItems;
39
+ top: number;
40
+ left: number;
41
+ } | null;
42
+ showWelcomeScreen: boolean;
43
+ isLoading: boolean;
44
+ errorMessage: React.ReactNode;
45
+ activeEmbeddable: {
46
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
47
+ state: "hover" | "active";
48
+ } | null;
49
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
50
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
51
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
52
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
53
+ isBindingEnabled: boolean;
54
+ boxSelectionMode: import("../types").BoxSelectionMode;
55
+ bindingPreference: "enabled" | "disabled";
56
+ isMidpointSnappingEnabled: boolean;
57
+ showHints: boolean;
58
+ inputDevice: import("../types").InputDevice;
59
+ suggestedBinding: {
60
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
61
+ midPoint?: import("@excalidraw/math").GlobalPoint;
62
+ } | null;
63
+ textToolHover: {
64
+ type: "text";
65
+ elementId: ExcalidrawElement["id"];
66
+ } | {
67
+ type: "container";
68
+ elementId: ExcalidrawElement["id"];
69
+ } | {
70
+ type: "arrow";
71
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
72
+ anchor: "start" | "end" | "label";
73
+ } | null;
74
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
75
+ frameRendering: {
76
+ enabled: boolean;
77
+ name: boolean;
78
+ outline: boolean;
79
+ clip: boolean;
80
+ };
81
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
82
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
83
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
84
+ preferredSelectionTool: {
85
+ type: "selection" | "lasso";
86
+ initialized: boolean;
87
+ };
88
+ penMode: boolean;
89
+ penDetected: boolean;
90
+ exportBackground: boolean;
91
+ exportEmbedScene: boolean;
92
+ exportWithDarkMode: boolean;
93
+ exportScale: number;
94
+ currentItemStrokeColor: string;
95
+ currentItemStickynoteStrokeColor: string;
96
+ currentItemStickynoteBackgroundColor: string;
97
+ currentItemBackgroundColor: string;
98
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
99
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
100
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
101
+ currentItemRoughness: number;
102
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
103
+ currentItemOpacity: number;
104
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
105
+ currentItemFontSize: number;
106
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
107
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
108
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
109
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
110
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
111
+ viewBackgroundColor: string;
112
+ scrollConstraints: import("../types").ScrollConstraints | null;
113
+ cursorButton: "up" | "down";
114
+ scrolledOutside: boolean;
115
+ isResizing: boolean;
116
+ isRotating: boolean;
117
+ openMenu: "canvas" | null;
118
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
119
+ openSidebar: {
120
+ name: import("../types").SidebarName;
121
+ tab?: import("../types").SidebarTabName;
122
+ } | null;
123
+ openDialog: null | {
124
+ name: "imageExport" | "help" | "jsonExport";
125
+ } | {
126
+ name: "ttd";
127
+ tab: "text-to-diagram" | "mermaid";
128
+ } | {
129
+ name: "commandPalette";
130
+ } | {
131
+ name: "settings";
132
+ } | {
133
+ name: "elementLinkSelector";
134
+ sourceElementId: ExcalidrawElement["id"];
135
+ } | {
136
+ name: "charts";
137
+ data: import("../charts").Spreadsheet;
138
+ rawText: string;
139
+ };
140
+ defaultSidebarDockedPreference: boolean;
141
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
142
+ selectedElementIds: Readonly<{
143
+ [id: string]: true;
144
+ }>;
145
+ hoveredElementIds: Readonly<{
146
+ [id: string]: true;
147
+ }>;
148
+ previousSelectedElementIds: {
149
+ [id: string]: true;
150
+ };
151
+ selectedElementsAreBeingDragged: boolean;
152
+ shouldCacheIgnoreZoom: boolean;
153
+ toast: {
154
+ message: React.ReactNode;
155
+ closable?: boolean;
156
+ duration?: number;
157
+ } | null;
158
+ gridStep: number;
159
+ selectedGroupIds: {
160
+ [groupId: string]: boolean;
161
+ };
162
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
163
+ fileHandle: FileSystemFileHandle | null;
164
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
165
+ stats: {
166
+ open: boolean;
167
+ panels: number;
168
+ };
169
+ showHyperlinkPopup: false | "info" | "editor";
170
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
171
+ snapLines: readonly import("../snapping").SnapLine[];
172
+ originSnapOffset: {
173
+ x: number;
174
+ y: number;
175
+ } | null;
176
+ isCropping: boolean;
177
+ croppingElementId: ExcalidrawElement["id"] | null;
178
+ searchMatches: Readonly<{
179
+ focusedId: ExcalidrawElement["id"] | null;
180
+ matches: readonly import("../types").SearchMatch[];
181
+ }> | null;
182
+ activeLockedId: string | null;
183
+ lockedMultiSelections: {
184
+ [groupId: string]: true;
185
+ };
186
+ bindMode: import("@excalidraw/element/types").BindMode;
187
+ colorTopPicks: {
188
+ elementStroke: readonly string[] | null;
189
+ elementBackground: readonly string[] | null;
190
+ bucketFill: readonly string[] | null;
191
+ stickyNoteStroke: readonly string[] | null;
192
+ stickyNoteBackground: readonly string[] | null;
193
+ };
194
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
195
+ };
196
+ files: BinaryFiles;
7
197
  }>;
8
- export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<import("./restore").RestoredDataState>;
9
198
  export declare const isValidExcalidrawData: (data?: {
10
199
  type?: any;
11
200
  elements?: any;
@@ -37,7 +37,7 @@ export interface LibraryMigrationAdapter {
37
37
  /** clears entire storage afterwards */
38
38
  clear(): MaybePromise<void>;
39
39
  }
40
- export declare const libraryItemsAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
40
+ export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
41
41
  status: "loading" | "loaded";
42
42
  /** indicates whether library is initialized with library items (has gone
43
43
  * through at least one update). Used in UI. Specific to this atom only. */
@@ -74,16 +74,31 @@ declare class Library {
74
74
  getLatestLibrary: () => Promise<LibraryItems>;
75
75
  updateLibrary: ({ libraryItems, prompt, merge, openLibraryMenu, defaultStatus, }: {
76
76
  libraryItems: LibraryItemsSource;
77
- merge?: boolean | undefined;
78
- prompt?: boolean | undefined;
79
- openLibraryMenu?: boolean | undefined;
80
- defaultStatus?: "published" | "unpublished" | undefined;
77
+ merge?: boolean;
78
+ prompt?: boolean;
79
+ openLibraryMenu?: boolean;
80
+ defaultStatus?: "unpublished" | "published";
81
81
  }) => Promise<LibraryItems>;
82
- setLibrary: (libraryItems: LibraryItems | Promise<LibraryItems> | ((latestLibraryItems: LibraryItems) => LibraryItems | Promise<LibraryItems>)) => Promise<LibraryItems>;
82
+ setLibrary: (
83
+ /**
84
+ * LibraryItems that will replace current items. Can be a function which
85
+ * will be invoked after all previous tasks are resolved
86
+ * (this is the prefered way to update the library to avoid race conditions,
87
+ * but you'll want to manually merge the library items in the callback
88
+ * - which is what we're doing in Library.importLibrary()).
89
+ *
90
+ * If supplied promise is rejected with AbortError, we swallow it and
91
+ * do not update the library.
92
+ */
93
+ libraryItems: LibraryItems | Promise<LibraryItems> | ((latestLibraryItems: LibraryItems) => LibraryItems | Promise<LibraryItems>)) => Promise<LibraryItems>;
83
94
  }
84
95
  export default Library;
85
96
  export declare const distributeLibraryItemsOnSquareGrid: (libraryItems: LibraryItems) => ExcalidrawElement[];
86
- export declare const validateLibraryUrl: (libraryUrl: string, validator?: string[] | ((libraryUrl: string) => boolean)) => true;
97
+ export declare const validateLibraryUrl: (libraryUrl: string,
98
+ /**
99
+ * @returns `true` if the URL is valid, throws otherwise.
100
+ */
101
+ validator?: ((libraryUrl: string) => boolean) | string[]) => true;
87
102
  export declare const parseLibraryTokensFromUrl: () => {
88
103
  libraryUrl: string;
89
104
  idToken: string | null;
@@ -95,10 +110,10 @@ export declare const useHandleLibrary: (opts: {
95
110
  * Return `true` if the library install url should be allowed.
96
111
  * If not supplied, only the excalidraw.com base domain is allowed.
97
112
  */
98
- validateLibraryUrl?: ((libraryUrl: string) => boolean) | undefined;
113
+ validateLibraryUrl?: (libraryUrl: string) => boolean;
99
114
  } & ({
100
115
  /** @deprecated we recommend using `opts.adapter` instead */
101
- getInitialLibraryItems?: (() => MaybePromise<LibraryItemsSource>) | undefined;
116
+ getInitialLibraryItems?: () => MaybePromise<LibraryItemsSource>;
102
117
  } | {
103
118
  adapter: LibraryPersistenceAdapter;
104
119
  /**
@@ -108,5 +123,5 @@ export declare const useHandleLibrary: (opts: {
108
123
  *
109
124
  * Can be a different LibraryPersistenceAdapter.
110
125
  */
111
- migrationAdapter?: LibraryMigrationAdapter | undefined;
126
+ migrationAdapter?: LibraryMigrationAdapter;
112
127
  })) => void;
@@ -1,5 +1,10 @@
1
+ import type { MaybePromise } from "@excalidraw/common/utility-types";
1
2
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
3
  import type { AppState, BinaryFiles } from "../types";
3
- export declare const resaveAsImageWithScene: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, name: string) => Promise<{
4
- fileHandle: import("browser-fs-access").FileSystemHandle;
4
+ export declare const resaveAsImageWithScene: (data: MaybePromise<{
5
+ elements: readonly ExcalidrawElement[];
6
+ appState: AppState;
7
+ files: BinaryFiles;
8
+ }>, fileHandle: FileSystemFileHandle, filename: string) => Promise<{
9
+ fileHandle: FileSystemFileHandle;
5
10
  }>;
@@ -1,4 +1,5 @@
1
- import type { ExcalidrawArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
1
+ import { type CombineBrandsIfNeeded } from "@excalidraw/common";
2
+ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawSelectionElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
2
3
  import type { AppState, BinaryFiles, LibraryItem } from "../types";
3
4
  import type { ImportedDataState } from "./types";
4
5
  type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
@@ -8,19 +9,33 @@ export type RestoredDataState = {
8
9
  appState: RestoredAppState;
9
10
  files: BinaryFiles;
10
11
  };
11
- export declare const restoreElement: (element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, opts?: {
12
+ export declare const restoreElement: (
13
+ /** element to be restored */
14
+ element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>,
15
+ /** all elements to be restored */
16
+ targetElementsMap: Readonly<ElementsMap>,
17
+ /** used for additional context */
18
+ existingElementsMap: Readonly<ElementsMap> | null | undefined, opts?: {
12
19
  deleteInvisibleElements?: boolean;
13
- }) => ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | ExcalidrawLinearElement | ExcalidrawArrowElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
14
- export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
20
+ }) => typeof element | null;
21
+ export declare const restoreElements: <T extends ExcalidrawElement>(targetElements: readonly T[] | undefined | null,
22
+ /** used for additional context (e.g. repairing arrow bindings) */
23
+ existingElements: Readonly<ElementsMapOrArray> | null | undefined, opts?: {
15
24
  refreshDimensions?: boolean;
16
25
  repairBindings?: boolean;
17
26
  deleteInvisibleElements?: boolean;
18
- } | undefined) => OrderedExcalidrawElement[];
27
+ } | undefined) => CombineBrandsIfNeeded<T, OrderedExcalidrawElement>;
28
+ /**
29
+ * When replacing elements that may exist locally, this bumps their versions
30
+ * to the local version + 1. Mainly for later reconciliation to work properly.
31
+ *
32
+ * See https://github.com/excalidraw/excalidraw/issues/3795
33
+ *
34
+ * Generally use this on editor boundaries (importing from file etc.), though
35
+ * it does not apply universally (e.g. we don't want to do this for collab
36
+ * updates).
37
+ */
38
+ export declare const bumpElementVersions: <T extends ExcalidrawElement>(targetElements: readonly T[], localElements: Readonly<ElementsMapOrArray> | null | undefined) => T[];
19
39
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
20
- export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
21
- refreshDimensions?: boolean;
22
- repairBindings?: boolean;
23
- deleteInvisibleElements?: boolean;
24
- }) => RestoredDataState;
25
40
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
26
41
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { VERSIONS } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { cleanAppStateForExport } from "../appState";
4
- import type { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion } from "../types";
4
+ import type { AppState, BinaryFiles, LibraryItem, LibraryItems, LibraryItems_anyVersion } from "../types";
5
5
  export interface ExportedDataState {
6
6
  type: string;
7
7
  version: number;
@@ -43,3 +43,6 @@ export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
43
43
  /** @deprecated v1 */
44
44
  library?: LibraryItems;
45
45
  }
46
+ export type ExcalidrawLibraryIds = {
47
+ itemIds: LibraryItem["id"][];
48
+ };
@@ -0,0 +1,16 @@
1
+ import type { GlobalPoint } from "@excalidraw/math";
2
+ import type App from "./components/App";
3
+ import type { Trail } from "./animatedTrail";
4
+ export declare class DrawShapeTrail implements Trail {
5
+ private app;
6
+ private trail;
7
+ constructor(app: App);
8
+ private getTrailOptions;
9
+ startPath(x: number, y: number): void;
10
+ addPointToPath(x: number, y: number): void;
11
+ endPath(): void;
12
+ clearTrails(): void;
13
+ getCurrentPoints(): GlobalPoint[];
14
+ start(container: SVGSVGElement): void;
15
+ stop(): void;
16
+ }
@@ -7,8 +7,8 @@ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof
7
7
  set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
8
8
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
9
9
  } | ({
10
- get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
11
- set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
10
+ get: <Value>(atom: import("jotai").Atom<Value>) => Value;
11
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
12
12
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
13
13
  } & {
14
14
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -19,21 +19,21 @@ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof
19
19
  readonly l: Set<() => void>;
20
20
  readonly d: Set<import("jotai").Atom<unknown>>;
21
21
  readonly t: Set<import("jotai").Atom<unknown>>;
22
- u?: (() => void) | undefined;
23
- } | undefined;
22
+ u?: () => void;
23
+ };
24
24
  v?: unknown;
25
25
  e?: unknown;
26
26
  }>;
27
27
  dev4_get_mounted_atoms: () => Set<import("jotai").Atom<unknown>>;
28
28
  dev4_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
29
- }) | undefined;
29
+ });
30
30
  } | undefined) => {
31
- get: <Value_3>(atom: import("jotai").Atom<Value_3>) => Value_3;
32
- set: <Value_1_2, Args_2 extends unknown[], Result_2>(atom: WritableAtom<Value_1_2, Args_2, Result_2>, ...args: Args_2) => Result_2;
31
+ get: <Value>(atom: import("jotai").Atom<Value>) => Value;
32
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
33
33
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
34
34
  } | ({
35
- get: <Value_4>(atom: import("jotai").Atom<Value_4>) => Value_4;
36
- set: <Value_1_3, Args_3 extends unknown[], Result_3>(atom: WritableAtom<Value_1_3, Args_3, Result_3>, ...args: Args_3) => Result_3;
35
+ get: <Value>(atom: import("jotai").Atom<Value>) => Value;
36
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
37
37
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
38
38
  } & {
39
39
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -44,8 +44,8 @@ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof
44
44
  readonly l: Set<() => void>;
45
45
  readonly d: Set<import("jotai").Atom<unknown>>;
46
46
  readonly t: Set<import("jotai").Atom<unknown>>;
47
- u?: (() => void) | undefined;
48
- } | undefined;
47
+ u?: () => void;
48
+ };
49
49
  v?: unknown;
50
50
  e?: unknown;
51
51
  }>;
@@ -1,10 +1,9 @@
1
- import { AnimatedTrail } from "../animated-trail";
2
- import type { AnimationFrameHandler } from "../animation-frame-handler";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class EraserTrail extends AnimatedTrail {
5
4
  private elementsToErase;
6
5
  private groupsToErase;
7
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
6
+ constructor(app: App);
8
7
  startPath(x: number, y: number): void;
9
8
  addPointToPath(x: number, y: number, restore?: boolean): string[];
10
9
  private updateElementsToBeErased;
@@ -26,4 +26,18 @@ export declare class WorkerInTheMainChunkError extends Error {
26
26
  export declare class ExcalidrawError extends Error {
27
27
  constructor(message: string);
28
28
  }
29
+ export declare class RequestError extends Error {
30
+ status: number;
31
+ data: any;
32
+ toObject(): {
33
+ name: string;
34
+ status: number;
35
+ message: string;
36
+ };
37
+ constructor({ message, status, data, }?: {
38
+ message?: string;
39
+ status?: number;
40
+ data?: any;
41
+ });
42
+ }
29
43
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type FontMetadata } from "@excalidraw/common";
2
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
3
3
  import type { Scene } from "@excalidraw/element";
4
4
  import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
5
5
  export declare class Fonts {
@@ -15,7 +15,9 @@ export declare class Fonts {
15
15
  fontFaces: ExcalidrawFontFace[];
16
16
  }>;
17
17
  private readonly scene;
18
- constructor(scene: Scene);
18
+ private readonly ownerDocument;
19
+ private readonly loadedFonts;
20
+ constructor(scene: Scene, ownerDocument?: Document);
19
21
  /**
20
22
  * Get all the font families for the given scene.
21
23
  */
@@ -32,11 +34,17 @@ export declare class Fonts {
32
34
  /**
33
35
  * Load font faces for a given scene and trigger scene update.
34
36
  */
35
- loadSceneFonts: () => Promise<FontFace[]>;
37
+ loadSceneFonts: (defaultFontFamily?: ExcalidrawTextElement["fontFamily"]) => Promise<FontFace[]>;
36
38
  /**
37
39
  * Load font faces for passed elements - use when the scene is unavailable (i.e. export).
40
+ *
41
+ * Loads into the document's font set, or in a worker into the worker's own
42
+ * (`self.fonts`, what an `OffscreenCanvas` there measures with). Where there
43
+ * is neither -- e.g. a DOM shim without `FontFaceSet` (`linkedom`), or Node
44
+ * -- nothing is loaded: the host makes the fonts available itself, and is
45
+ * warned once if the elements use fonts that would need loading.
38
46
  */
39
- static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
47
+ static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
40
48
  /**
41
49
  * Generate CSS @font-face declarations for the given elements.
42
50
  */
@@ -68,10 +76,6 @@ export declare class Fonts {
68
76
  * Get characters for a given family.
69
77
  */
70
78
  private static getCharacters;
71
- /**
72
- * Get all registered font families.
73
- */
74
- private static getAllFamilies;
75
79
  }
76
80
  export interface ExcalidrawFontFaceDescriptor {
77
81
  uri: string;
@@ -1,13 +1,15 @@
1
1
  import { Emitter } from "@excalidraw/common";
2
2
  import { StoreDelta } from "@excalidraw/element";
3
- import type { StoreSnapshot, Store } from "@excalidraw/element";
3
+ import type { RenderEnvironment, StoreSnapshot, Store } from "@excalidraw/element";
4
4
  import type { SceneElementsMap } from "@excalidraw/element/types";
5
5
  import type { AppState } from "./types";
6
6
  export declare class HistoryDelta extends StoreDelta {
7
7
  /**
8
8
  * Apply the delta to the passed elements and appState, does not modify the snapshot.
9
9
  */
10
- applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot): [SceneElementsMap, AppState, boolean];
10
+ applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot,
11
+ /** measures the labels re-laid out after applying */
12
+ renderEnvironment?: RenderEnvironment): [SceneElementsMap, AppState, boolean];
11
13
  /**
12
14
  * Overriding once to avoid type casting everywhere.
13
15
  */
@@ -40,8 +42,12 @@ export declare class History {
40
42
  * Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
41
43
  */
42
44
  record(delta: StoreDelta): void;
43
- undo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
44
- redo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
45
+ undo(elements: SceneElementsMap, appState: AppState,
46
+ /** measures the labels re-laid out after undoing (the host's, in the editor) */
47
+ renderEnvironment?: RenderEnvironment): void | [SceneElementsMap, AppState];
48
+ redo(elements: SceneElementsMap, appState: AppState,
49
+ /** measures the labels re-laid out after redoing (the host's, in the editor) */
50
+ renderEnvironment?: RenderEnvironment): void | [SceneElementsMap, AppState];
45
51
  private perform;
46
52
  private static pop;
47
53
  private static push;
@@ -0,0 +1,29 @@
1
+ import type { AppState } from "../types";
2
+ /**
3
+ * Subscribes to specific appState changes. The component re-renders
4
+ * only when the specified prop(s) change — not on every appState update.
5
+ *
6
+ * Works both inside and outside the <Excalidraw> tree, as long as
7
+ * ExcalidrawAPIContext.Provider is an ancestor (automatically provided
8
+ * inside <Excalidraw>, or manually by the host app).
9
+ *
10
+ * Returns the narrowed value depending on prop form:
11
+ * - `keyof AppState` → `AppState[K]`
12
+ * - `(keyof AppState)[]` → whole `AppState`
13
+ * - selector function → selector's return type `T`
14
+ *
15
+ * If excalidrawAPI is not ready yet (host apps), hook is rerendered with latest
16
+ * value once available.
17
+ */
18
+ export declare function useAppStateValue<K extends keyof AppState>(prop: K, _internal?: boolean): AppState[K];
19
+ export declare function useAppStateValue(props: (keyof AppState)[], _internal?: boolean): AppState;
20
+ export declare function useAppStateValue<T>(selector: (appState: AppState) => T, _internal?: boolean): T;
21
+ /**
22
+ * Subscribes to specific appState changes without causing component rerenders.
23
+ *
24
+ * The callback is called on every matching change, but also on initial render
25
+ * so you can initialize your state.
26
+ */
27
+ export declare function useOnAppStateChange<K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void): undefined;
28
+ export declare function useOnAppStateChange(props: (keyof AppState)[], callback: (props: AppState, appState: AppState) => void): undefined;
29
+ export declare function useOnAppStateChange<T>(selector: (appState: AppState) => T, callback: (value: T, appState: AppState) => void): undefined;
@@ -1,9 +1,9 @@
1
1
  import type { LibraryItem } from "../types";
2
2
  export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
3
- export declare const libraryItemSvgsCache: import("jotai/vanilla/atom").PrimitiveAtom<SvgCache> & {
3
+ export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
4
4
  init: SvgCache;
5
5
  };
6
- export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
6
+ export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache, ref: React.RefObject<HTMLDivElement | null>) => SVGSVGElement | undefined;
7
7
  export declare const useLibraryCache: () => {
8
8
  clearLibraryCache: () => void;
9
9
  deleteItemsFromLibraryCache: (items: LibraryItem["id"][]) => void;
@@ -1,7 +1,8 @@
1
- /// <reference types="react" />
2
1
  export declare function useOutsideClick<T extends HTMLElement>(ref: React.RefObject<T | null>,
3
2
  /** if performance is of concern, memoize the callback */
4
- callback: (event: Event) => void,
3
+ callback: (event: Event & {
4
+ target: T;
5
+ }) => void,
5
6
  /**
6
7
  * Optional callback which is called on every click.
7
8
  *
@@ -14,7 +15,7 @@ callback: (event: Event) => void,
14
15
  * Returning `undefined` will fallback to the default behavior.
15
16
  */
16
17
  isInside?: (event: Event & {
17
- target: HTMLElement;
18
+ target: T;
18
19
  },
19
20
  /** the element of the passed ref */
20
21
  container: T) => boolean | undefined): void;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const useScrollPosition: <T extends HTMLElement>(elementRef: import("react").RefObject<T | null>) => number;
1
+ export declare const useScrollPosition: <T extends HTMLElement>(elementRef: React.RefObject<T | null>) => number;
@@ -0,0 +1,14 @@
1
+ export type CaretPosition = {
2
+ start: number;
3
+ end: number;
4
+ };
5
+ export declare const saveCaretPosition: (ownerDocument?: Document) => CaretPosition | null;
6
+ export declare const restoreCaretPosition: (position: CaretPosition | null, ownerDocument?: Document) => void;
7
+ export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void, ownerDocument?: Document) => void;
8
+ export declare const useTextEditorFocus: (ownerDocument?: Document) => {
9
+ saveCaretPosition: () => void;
10
+ restoreCaretPosition: () => void;
11
+ clearSavedPosition: () => void;
12
+ hasSavedPosition: boolean;
13
+ };
14
+ export declare const temporarilyDisableTextEditorBlur: (ownerDocument?: Document, duration?: number) => void;
@@ -15,10 +15,10 @@ export declare const setLanguage: (lang: Language) => Promise<void>;
15
15
  export declare const getLanguage: () => Language;
16
16
  export declare const t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
17
17
  [key: string]: string | number;
18
- } | null | undefined, fallback?: string) => string;
18
+ } | null, fallback?: string) => string;
19
19
  export declare const useI18n: () => {
20
20
  t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
21
21
  [key: string]: string | number;
22
- } | null | undefined, fallback?: string) => string;
22
+ } | null, fallback?: string) => string;
23
23
  langCode: string;
24
24
  };