@excalidraw/element 0.18.0-d2463f87d → 0.18.0-d9e8a33

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 (277) hide show
  1. package/dist/dev/index.js +6064 -3063
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +19 -18
  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 +59 -39
  8. package/dist/types/common/src/constants.d.ts +38 -26
  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 +1 -1
  13. package/dist/types/common/src/utility-types.d.ts +0 -1
  14. package/dist/types/common/src/utils.d.ts +53 -41
  15. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  16. package/dist/types/element/src/Scene.d.ts +11 -5
  17. package/dist/types/element/src/align.d.ts +2 -1
  18. package/dist/types/element/src/arrowheads.d.ts +3 -0
  19. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  20. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  21. package/dist/types/element/src/binding.d.ts +67 -48
  22. package/dist/types/element/src/bounds.d.ts +8 -14
  23. package/dist/types/element/src/collision.d.ts +7 -2
  24. package/dist/types/element/src/comparisons.d.ts +7 -7
  25. package/dist/types/element/src/delta.d.ts +16 -4
  26. package/dist/types/element/src/distribute.d.ts +3 -1
  27. package/dist/types/element/src/dragElements.d.ts +3 -3
  28. package/dist/types/element/src/duplicate.d.ts +3 -3
  29. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  30. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  31. package/dist/types/element/src/frame.d.ts +6 -2
  32. package/dist/types/element/src/groups.d.ts +1 -0
  33. package/dist/types/element/src/heading.d.ts +2 -1
  34. package/dist/types/element/src/image.d.ts +1 -11
  35. package/dist/types/element/src/index.d.ts +5 -3
  36. package/dist/types/element/src/linearElementEditor.d.ts +25 -23
  37. package/dist/types/element/src/mutateElement.d.ts +5 -1
  38. package/dist/types/element/src/newElement.d.ts +6 -6
  39. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  40. package/dist/types/element/src/renderElement.d.ts +4 -7
  41. package/dist/types/element/src/resizeElements.d.ts +10 -10
  42. package/dist/types/element/src/resizeTest.d.ts +6 -5
  43. package/dist/types/element/src/selection.d.ts +10 -10
  44. package/dist/types/element/src/shape.d.ts +9 -8
  45. package/dist/types/element/src/store.d.ts +8 -2
  46. package/dist/types/element/src/textElement.d.ts +2 -2
  47. package/dist/types/element/src/textMeasurements.d.ts +1 -3
  48. package/dist/types/element/src/textWrapping.d.ts +26 -0
  49. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
  50. package/dist/types/element/src/transformHandles.d.ts +8 -27
  51. package/dist/types/element/src/typeChecks.d.ts +4 -7
  52. package/dist/types/element/src/types.d.ts +12 -13
  53. package/dist/types/element/src/utils.d.ts +9 -4
  54. package/dist/types/element/src/visualdebug.d.ts +59 -0
  55. package/dist/types/element/src/zindex.d.ts +7 -1
  56. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +131 -171
  57. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
  58. package/dist/types/excalidraw/actions/actionBoundText.d.ts +94 -121
  59. package/dist/types/excalidraw/actions/actionCanvas.d.ts +557 -902
  60. package/dist/types/excalidraw/actions/actionClipboard.d.ts +111 -882
  61. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +45 -59
  62. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +154 -198
  63. package/dist/types/excalidraw/actions/actionDeselect.d.ts +160 -0
  64. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  65. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
  66. package/dist/types/excalidraw/actions/actionElementLink.d.ts +37 -57
  67. package/dist/types/excalidraw/actions/actionElementLock.d.ts +92 -119
  68. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +46 -60
  69. package/dist/types/excalidraw/actions/actionExport.d.ts +173 -1412
  70. package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -395
  71. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  72. package/dist/types/excalidraw/actions/actionFrame.d.ts +279 -370
  73. package/dist/types/excalidraw/actions/actionGroup.d.ts +97 -132
  74. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +176 -197
  75. package/dist/types/excalidraw/actions/actionLink.d.ts +43 -57
  76. package/dist/types/excalidraw/actions/actionMenu.d.ts +36 -424
  77. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -361
  78. package/dist/types/excalidraw/actions/actionProperties.d.ts +152 -2522
  79. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -66
  80. package/dist/types/excalidraw/actions/actionStyles.d.ts +45 -58
  81. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  82. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +173 -0
  83. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +45 -59
  84. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +173 -0
  85. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +45 -59
  86. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +34 -54
  87. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  88. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +45 -59
  89. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +45 -59
  90. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +46 -60
  91. package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -3
  92. package/dist/types/excalidraw/actions/index.d.ts +5 -2
  93. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  94. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  95. package/dist/types/excalidraw/actions/types.d.ts +4 -4
  96. package/dist/types/excalidraw/appState.d.ts +22 -14
  97. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  98. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  99. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  100. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  101. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  102. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  103. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  104. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  105. package/dist/types/excalidraw/clipboard.d.ts +57 -19
  106. package/dist/types/excalidraw/components/Actions.d.ts +21 -8
  107. package/dist/types/excalidraw/components/App.d.ts +118 -75
  108. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  109. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  110. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  111. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
  112. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  113. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  114. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  115. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -1
  116. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
  117. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  118. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  119. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
  120. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  121. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  122. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  123. package/dist/types/excalidraw/components/Ellipsify.d.ts +3 -0
  124. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  125. package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
  126. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  127. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  128. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  129. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  130. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  131. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  132. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  133. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  134. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  135. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  136. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  137. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  138. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
  139. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  140. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  141. package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  142. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  143. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  144. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  145. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  146. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  147. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  148. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  149. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  150. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  151. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
  152. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  153. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  154. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  155. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  156. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  157. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  158. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  159. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  160. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
  161. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  162. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  163. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  164. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  165. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  166. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  167. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  168. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  169. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  170. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
  171. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  172. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  173. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  174. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  175. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  176. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  177. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  178. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  179. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  180. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  181. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  182. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
  183. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  184. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  185. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  186. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  187. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  188. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  189. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  190. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  191. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  192. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  193. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  194. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  195. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  196. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  197. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +7 -3
  198. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  199. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  200. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  201. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  202. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  203. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  204. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  205. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  206. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  207. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  208. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  209. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  210. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  211. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  212. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  213. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  214. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
  215. package/dist/types/excalidraw/components/icons.d.ts +49 -21
  216. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +20 -2
  217. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  218. package/dist/types/excalidraw/components/shapes.d.ts +202 -1
  219. package/dist/types/excalidraw/data/blob.d.ts +329 -12
  220. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  221. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  222. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  223. package/dist/types/excalidraw/data/index.d.ts +4 -5
  224. package/dist/types/excalidraw/data/json.d.ts +171 -4
  225. package/dist/types/excalidraw/data/library.d.ts +24 -9
  226. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  227. package/dist/types/excalidraw/data/restore.d.ts +27 -7
  228. package/dist/types/excalidraw/data/types.d.ts +4 -1
  229. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  230. package/dist/types/excalidraw/errors.d.ts +14 -0
  231. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  232. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  233. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  234. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  235. package/dist/types/excalidraw/i18n.d.ts +2 -2
  236. package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
  237. package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
  238. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
  239. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  240. package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
  241. package/dist/types/excalidraw/scene/export.d.ts +2 -2
  242. package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
  243. package/dist/types/excalidraw/scene/types.d.ts +22 -5
  244. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  245. package/dist/types/excalidraw/snapping.d.ts +5 -5
  246. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  247. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  248. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  249. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  250. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  251. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  252. package/dist/types/excalidraw/types.d.ts +130 -38
  253. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +7 -3
  254. package/dist/types/math/src/curve.d.ts +4 -1
  255. package/dist/types/math/src/point.d.ts +7 -2
  256. package/dist/types/math/src/polygon.d.ts +2 -2
  257. package/dist/types/math/src/range.d.ts +1 -3
  258. package/dist/types/math/src/segment.d.ts +4 -3
  259. package/dist/types/math/src/types.d.ts +25 -1
  260. package/dist/types/utils/src/bbox.d.ts +1 -1
  261. package/dist/types/utils/src/export.d.ts +5 -5
  262. package/dist/types/utils/src/shape.d.ts +6 -6
  263. package/dist/types/utils/src/withinBounds.d.ts +2 -2
  264. package/package.json +9 -3
  265. package/dist/types/excalidraw/charts.d.ts +0 -27
  266. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  267. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  268. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  269. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  270. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  271. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  272. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  273. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  274. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  275. package/dist/types/excalidraw/data/reconcile.d.ts +0 -6
  276. package/dist/types/excalidraw/index.d.ts +0 -46
  277. package/dist/types/excalidraw/polyfill.d.ts +0 -2
@@ -2,24 +2,345 @@ import { IMAGE_MIME_TYPES, MIME_TYPES } from "@excalidraw/common";
2
2
  import type { ValueOf } from "@excalidraw/common/utility-types";
3
3
  import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
4
4
  import type { AppState, DataURL, LibraryItem } from "../types";
5
- import type { FileSystemHandle } from "./filesystem";
6
5
  import type { ImportedLibraryData } from "./types";
7
6
  export declare const getMimeType: (blob: Blob | string) => string;
8
- export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
7
+ export declare const getFileHandleType: (handle: FileSystemFileHandle | null) => string | null;
9
8
  export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
10
- export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
9
+ export declare const isImageFileHandle: (handle: FileSystemFileHandle | null) => handle is FileSystemFileHandle;
11
10
  export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
12
11
  export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
13
12
  type: ValueOf<typeof IMAGE_MIME_TYPES>;
14
13
  };
15
- export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<{
14
+ export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File,
15
+ /** @see restore.localAppState */
16
+ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
17
+ /** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
18
+ fileHandle?: FileSystemFileHandle | null) => Promise<{
16
19
  type: "application/vnd.excalidraw+json";
17
- data: import("./restore").RestoredDataState;
20
+ data: {
21
+ elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
22
+ appState: {
23
+ viewBackgroundColor: string;
24
+ theme: import("@excalidraw/element/types").Theme;
25
+ frameRendering: {
26
+ enabled: boolean;
27
+ name: boolean;
28
+ outline: boolean;
29
+ clip: boolean;
30
+ };
31
+ name: string | null;
32
+ zoom: import("../types").Zoom;
33
+ scrollX: number;
34
+ scrollY: number;
35
+ viewModeEnabled: boolean;
36
+ openDialog: null | {
37
+ name: "imageExport" | "help" | "jsonExport";
38
+ } | {
39
+ name: "ttd";
40
+ tab: "text-to-diagram" | "mermaid";
41
+ } | {
42
+ name: "commandPalette";
43
+ } | {
44
+ name: "settings";
45
+ } | {
46
+ name: "elementLinkSelector";
47
+ sourceElementId: ExcalidrawElement["id"];
48
+ } | {
49
+ name: "charts";
50
+ data: import("../charts").Spreadsheet;
51
+ rawText: string;
52
+ };
53
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
54
+ selectedElementIds: Readonly<{
55
+ [id: string]: true;
56
+ }>;
57
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
58
+ activeTool: {
59
+ lastActiveTool: import("../types").ActiveTool | null;
60
+ locked: boolean;
61
+ fromSelection: boolean;
62
+ } & import("../types").ActiveTool;
63
+ activeEmbeddable: {
64
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
65
+ state: "hover" | "active";
66
+ } | null;
67
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
68
+ selectedGroupIds: {
69
+ [groupId: string]: boolean;
70
+ };
71
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
72
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
73
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
74
+ isBindingEnabled: boolean;
75
+ isMidpointSnappingEnabled: boolean;
76
+ suggestedBinding: {
77
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
78
+ midPoint?: import("@excalidraw/math").GlobalPoint;
79
+ } | null;
80
+ isRotating: boolean;
81
+ elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
82
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
83
+ snapLines: readonly import("../snapping").SnapLine[];
84
+ zenModeEnabled: boolean;
85
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
86
+ isCropping: boolean;
87
+ croppingElementId: ExcalidrawElement["id"] | null;
88
+ searchMatches: Readonly<{
89
+ focusedId: ExcalidrawElement["id"] | null;
90
+ matches: readonly import("../types").SearchMatch[];
91
+ }> | null;
92
+ activeLockedId: string | null;
93
+ hoveredElementIds: Readonly<{
94
+ [id: string]: true;
95
+ }>;
96
+ shouldCacheIgnoreZoom: boolean;
97
+ exportScale: number;
98
+ currentItemArrowType: "sharp" | "round" | "elbow";
99
+ bindMode: import("@excalidraw/element/types").BindMode;
100
+ gridSize: number;
101
+ contextMenu: {
102
+ items: import("../components/ContextMenu").ContextMenuItems;
103
+ top: number;
104
+ left: number;
105
+ } | null;
106
+ showWelcomeScreen: boolean;
107
+ isLoading: boolean;
108
+ errorMessage: React.ReactNode;
109
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
110
+ boxSelectionMode: import("../types").BoxSelectionMode;
111
+ bindingPreference: "enabled" | "disabled";
112
+ startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
113
+ editingFrame: string | null;
114
+ preferredSelectionTool: {
115
+ type: "selection" | "lasso";
116
+ initialized: boolean;
117
+ };
118
+ penMode: boolean;
119
+ penDetected: boolean;
120
+ exportBackground: boolean;
121
+ exportEmbedScene: boolean;
122
+ exportWithDarkMode: boolean;
123
+ currentItemStrokeColor: string;
124
+ currentItemBackgroundColor: string;
125
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
126
+ currentItemStrokeWidth: number;
127
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
128
+ currentItemRoughness: number;
129
+ currentItemOpacity: number;
130
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
131
+ currentItemFontSize: number;
132
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
133
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
134
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
135
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
136
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
137
+ cursorButton: "up" | "down";
138
+ scrolledOutside: boolean;
139
+ isResizing: boolean;
140
+ openMenu: "canvas" | null;
141
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
142
+ openSidebar: {
143
+ name: import("../types").SidebarName;
144
+ tab?: import("../types").SidebarTabName;
145
+ } | null;
146
+ defaultSidebarDockedPreference: boolean;
147
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
148
+ previousSelectedElementIds: {
149
+ [id: string]: true;
150
+ };
151
+ selectedElementsAreBeingDragged: boolean;
152
+ toast: {
153
+ message: React.ReactNode;
154
+ closable?: boolean;
155
+ duration?: number;
156
+ } | null;
157
+ gridStep: number;
158
+ gridModeEnabled: boolean;
159
+ fileHandle: FileSystemFileHandle | null;
160
+ stats: {
161
+ open: boolean;
162
+ panels: number;
163
+ };
164
+ showHyperlinkPopup: false | "info" | "editor";
165
+ originSnapOffset: {
166
+ x: number;
167
+ y: number;
168
+ } | null;
169
+ objectsSnapModeEnabled: boolean;
170
+ userToFollow: import("../types").UserToFollow | null;
171
+ followedBy: Set<import("../types").SocketId>;
172
+ lockedMultiSelections: {
173
+ [groupId: string]: true;
174
+ };
175
+ };
176
+ files: import("../types").BinaryFiles;
177
+ };
18
178
  } | {
19
179
  type: "application/vnd.excalidrawlib+json";
20
180
  data: ImportedLibraryData;
21
181
  }>;
22
- export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<import("./restore").RestoredDataState>;
182
+ export declare const loadFromBlob: (blob: Blob,
183
+ /** @see restore.localAppState */
184
+ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
185
+ /** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
186
+ fileHandle?: FileSystemFileHandle | null) => Promise<{
187
+ elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
188
+ appState: {
189
+ viewBackgroundColor: string;
190
+ theme: import("@excalidraw/element/types").Theme;
191
+ frameRendering: {
192
+ enabled: boolean;
193
+ name: boolean;
194
+ outline: boolean;
195
+ clip: boolean;
196
+ };
197
+ name: string | null;
198
+ zoom: import("../types").Zoom;
199
+ scrollX: number;
200
+ scrollY: number;
201
+ viewModeEnabled: boolean;
202
+ openDialog: null | {
203
+ name: "imageExport" | "help" | "jsonExport";
204
+ } | {
205
+ name: "ttd";
206
+ tab: "text-to-diagram" | "mermaid";
207
+ } | {
208
+ name: "commandPalette";
209
+ } | {
210
+ name: "settings";
211
+ } | {
212
+ name: "elementLinkSelector";
213
+ sourceElementId: ExcalidrawElement["id"];
214
+ } | {
215
+ name: "charts";
216
+ data: import("../charts").Spreadsheet;
217
+ rawText: string;
218
+ };
219
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
220
+ selectedElementIds: Readonly<{
221
+ [id: string]: true;
222
+ }>;
223
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
224
+ activeTool: {
225
+ lastActiveTool: import("../types").ActiveTool | null;
226
+ locked: boolean;
227
+ fromSelection: boolean;
228
+ } & import("../types").ActiveTool;
229
+ activeEmbeddable: {
230
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
231
+ state: "hover" | "active";
232
+ } | null;
233
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
234
+ selectedGroupIds: {
235
+ [groupId: string]: boolean;
236
+ };
237
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
238
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
239
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
240
+ isBindingEnabled: boolean;
241
+ isMidpointSnappingEnabled: boolean;
242
+ suggestedBinding: {
243
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
244
+ midPoint?: import("@excalidraw/math").GlobalPoint;
245
+ } | null;
246
+ isRotating: boolean;
247
+ elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
248
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
249
+ snapLines: readonly import("../snapping").SnapLine[];
250
+ zenModeEnabled: boolean;
251
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
252
+ isCropping: boolean;
253
+ croppingElementId: ExcalidrawElement["id"] | null;
254
+ searchMatches: Readonly<{
255
+ focusedId: ExcalidrawElement["id"] | null;
256
+ matches: readonly import("../types").SearchMatch[];
257
+ }> | null;
258
+ activeLockedId: string | null;
259
+ hoveredElementIds: Readonly<{
260
+ [id: string]: true;
261
+ }>;
262
+ shouldCacheIgnoreZoom: boolean;
263
+ exportScale: number;
264
+ currentItemArrowType: "sharp" | "round" | "elbow";
265
+ bindMode: import("@excalidraw/element/types").BindMode;
266
+ gridSize: number;
267
+ contextMenu: {
268
+ items: import("../components/ContextMenu").ContextMenuItems;
269
+ top: number;
270
+ left: number;
271
+ } | null;
272
+ showWelcomeScreen: boolean;
273
+ isLoading: boolean;
274
+ errorMessage: React.ReactNode;
275
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
276
+ boxSelectionMode: import("../types").BoxSelectionMode;
277
+ bindingPreference: "enabled" | "disabled";
278
+ startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
279
+ editingFrame: string | null;
280
+ preferredSelectionTool: {
281
+ type: "selection" | "lasso";
282
+ initialized: boolean;
283
+ };
284
+ penMode: boolean;
285
+ penDetected: boolean;
286
+ exportBackground: boolean;
287
+ exportEmbedScene: boolean;
288
+ exportWithDarkMode: boolean;
289
+ currentItemStrokeColor: string;
290
+ currentItemBackgroundColor: string;
291
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
292
+ currentItemStrokeWidth: number;
293
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
294
+ currentItemRoughness: number;
295
+ currentItemOpacity: number;
296
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
297
+ currentItemFontSize: number;
298
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
299
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
300
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
301
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
302
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
303
+ cursorButton: "up" | "down";
304
+ scrolledOutside: boolean;
305
+ isResizing: boolean;
306
+ openMenu: "canvas" | null;
307
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
308
+ openSidebar: {
309
+ name: import("../types").SidebarName;
310
+ tab?: import("../types").SidebarTabName;
311
+ } | null;
312
+ defaultSidebarDockedPreference: boolean;
313
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
314
+ previousSelectedElementIds: {
315
+ [id: string]: true;
316
+ };
317
+ selectedElementsAreBeingDragged: boolean;
318
+ toast: {
319
+ message: React.ReactNode;
320
+ closable?: boolean;
321
+ duration?: number;
322
+ } | null;
323
+ gridStep: number;
324
+ gridModeEnabled: boolean;
325
+ fileHandle: FileSystemFileHandle | null;
326
+ stats: {
327
+ open: boolean;
328
+ panels: number;
329
+ };
330
+ showHyperlinkPopup: false | "info" | "editor";
331
+ originSnapOffset: {
332
+ x: number;
333
+ y: number;
334
+ } | null;
335
+ objectsSnapModeEnabled: boolean;
336
+ userToFollow: import("../types").UserToFollow | null;
337
+ followedBy: Set<import("../types").SocketId>;
338
+ lockedMultiSelections: {
339
+ [groupId: string]: true;
340
+ };
341
+ };
342
+ files: import("../types").BinaryFiles;
343
+ }>;
23
344
  export declare const parseLibraryJSON: (json: string, defaultStatus?: LibraryItem["status"]) => LibraryItem[];
24
345
  export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
25
346
  export declare const canvasToBlob: (canvas: HTMLCanvasElement | Promise<HTMLCanvasElement>) => Promise<Blob>;
@@ -40,12 +361,8 @@ export declare const SVGStringToFile: (SVGString: string, filename?: string) =>
40
361
  type: typeof MIME_TYPES.svg;
41
362
  };
42
363
  export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
43
- export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>) => Promise<{
44
- file: File | null;
45
- fileHandle: FileSystemHandle | null;
46
- }>;
47
- export declare const getFileHandle: (event: React.DragEvent<HTMLDivElement>) => Promise<FileSystemHandle | null>;
48
- export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>, name: string | undefined) => File;
364
+ export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<FileSystemFileHandle | null>;
365
+ export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: string, name: string | undefined) => File;
49
366
  /** attempts to detect correct mimeType if none is set, or if an image
50
367
  * has an incorrect extension.
51
368
  * Note: doesn't handle missing .excalidraw/.excalidrawlib extension */
@@ -21,7 +21,7 @@ type EncodedData = {
21
21
  export declare const encode: ({ text, compress, }: {
22
22
  text: string;
23
23
  /** defaults to `true`. If compression fails, falls back to bstring alone. */
24
- compress?: boolean | undefined;
24
+ compress?: boolean;
25
25
  }) => EncodedData;
26
26
  export declare const decode: (data: EncodedData) => string;
27
27
  /**
@@ -40,16 +40,16 @@ export declare const decode: (data: EncodedData) => string;
40
40
  export declare const compressData: <T extends Record<string, any> = never>(dataBuffer: Uint8Array, options: {
41
41
  encryptionKey: string;
42
42
  } & ([T] extends [never] ? {
43
- metadata?: T | undefined;
43
+ metadata?: T;
44
44
  } : {
45
45
  metadata: T;
46
- })) => Promise<Uint8Array>;
46
+ })) => Promise<Uint8Array<ArrayBuffer>>;
47
47
  export declare const decompressData: <T extends Record<string, any>>(bufferView: Uint8Array, options: {
48
48
  decryptionKey: string;
49
49
  }) => Promise<{
50
50
  /** metadata source is always JSON so we can decode it here */
51
51
  metadata: T;
52
52
  /** data can be anything so the caller must decode it */
53
- data: Uint8Array;
53
+ data: Uint8Array<ArrayBuffer>;
54
54
  }>;
55
55
  export {};
@@ -1,9 +1,9 @@
1
1
  export declare const IV_LENGTH_BYTES = 12;
2
- export declare const createIV: () => Uint8Array;
3
- export declare const generateEncryptionKey: <T extends "string" | "cryptoKey" = "string">(returnAs?: T | undefined) => Promise<T extends "cryptoKey" ? CryptoKey : string>;
2
+ export declare const createIV: () => Uint8Array<ArrayBuffer>;
3
+ export declare const generateEncryptionKey: <T extends "string" | "cryptoKey" = "string">(returnAs?: T) => Promise<T extends "cryptoKey" ? CryptoKey : string>;
4
4
  export declare const getCryptoKey: (key: string, usage: KeyUsage) => Promise<CryptoKey>;
5
- export declare const encryptData: (key: string | CryptoKey, data: Uint8Array | ArrayBuffer | Blob | File | string) => Promise<{
5
+ export declare const encryptData: (key: string | CryptoKey, data: Uint8Array<ArrayBuffer> | ArrayBuffer | Blob | File | string) => Promise<{
6
6
  encryptedBuffer: ArrayBuffer;
7
- iv: Uint8Array;
7
+ iv: Uint8Array<ArrayBuffer>;
8
8
  }>;
9
- export declare const decryptData: (iv: Uint8Array, encrypted: Uint8Array | ArrayBuffer, privateKey: string) => Promise<ArrayBuffer>;
9
+ export declare const decryptData: (iv: Uint8Array<ArrayBuffer>, encrypted: Uint8Array<ArrayBuffer> | ArrayBuffer, privateKey: string) => Promise<ArrayBuffer>;
@@ -1,11 +1,10 @@
1
1
  import { supported as nativeFileSystemSupported } from "browser-fs-access";
2
2
  import { MIME_TYPES } from "@excalidraw/common";
3
- import type { FileSystemHandle } from "browser-fs-access";
4
3
  type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
5
4
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
6
- extensions?: FILE_EXTENSION[] | undefined;
5
+ extensions?: FILE_EXTENSION[];
7
6
  description: string;
8
- multiple?: M | undefined;
7
+ multiple?: M;
9
8
  }) => Promise<M extends false | undefined ? File : File[]>;
10
9
  export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
11
10
  /** supply without the extension */
@@ -14,8 +13,7 @@ export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
14
13
  extension: FILE_EXTENSION;
15
14
  mimeTypes?: string[];
16
15
  description: string;
17
- /** existing FileSystemHandle */
18
- fileHandle?: FileSystemHandle | null;
19
- }) => Promise<FileSystemHandle | null>;
16
+ /** existing FileSystemFileHandle */
17
+ fileHandle?: FileSystemFileHandle | null;
18
+ }) => Promise<FileSystemFileHandle | null>;
20
19
  export { nativeFileSystemSupported };
21
- export type { FileSystemHandle };
@@ -1,5 +1,4 @@
1
1
  import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- import type { FileSystemHandle } from "./filesystem";
3
2
  import type { ExportType } from "../scene/types";
4
3
  import type { AppState, BinaryFiles } from "../types";
5
4
  export { loadFromBlob } from "./blob";
@@ -13,10 +12,10 @@ export declare const prepareElementsForExport: (elements: readonly ExcalidrawEle
13
12
  };
14
13
  export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
15
14
  exportBackground: boolean;
16
- exportPadding?: number | undefined;
15
+ exportPadding?: number;
17
16
  viewBackgroundColor: string;
18
17
  /** filename, if applicable */
19
- name?: string | undefined;
20
- fileHandle?: FileSystemHandle | null | undefined;
18
+ name?: string;
19
+ fileHandle?: FileSystemFileHandle | null;
21
20
  exportingFrame: ExcalidrawFrameLikeElement | null;
22
- }) => Promise<FileSystemHandle | null | undefined>;
21
+ }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -1,11 +1,178 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement, NonDeleted } 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 NonDeleted<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
+ viewBackgroundColor: string;
22
+ theme: import("@excalidraw/element/types").Theme;
23
+ frameRendering: {
24
+ enabled: boolean;
25
+ name: boolean;
26
+ outline: boolean;
27
+ clip: boolean;
28
+ };
29
+ name: string | null;
30
+ zoom: import("../types").Zoom;
31
+ scrollX: number;
32
+ scrollY: number;
33
+ viewModeEnabled: boolean;
34
+ openDialog: null | {
35
+ name: "imageExport" | "help" | "jsonExport";
36
+ } | {
37
+ name: "ttd";
38
+ tab: "text-to-diagram" | "mermaid";
39
+ } | {
40
+ name: "commandPalette";
41
+ } | {
42
+ name: "settings";
43
+ } | {
44
+ name: "elementLinkSelector";
45
+ sourceElementId: ExcalidrawElement["id"];
46
+ } | {
47
+ name: "charts";
48
+ data: import("../charts").Spreadsheet;
49
+ rawText: string;
50
+ };
51
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
52
+ selectedElementIds: Readonly<{
53
+ [id: string]: true;
54
+ }>;
55
+ frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
56
+ activeTool: {
57
+ lastActiveTool: import("../types").ActiveTool | null;
58
+ locked: boolean;
59
+ fromSelection: boolean;
60
+ } & import("../types").ActiveTool;
61
+ activeEmbeddable: {
62
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
63
+ state: "hover" | "active";
64
+ } | null;
65
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
66
+ selectedGroupIds: {
67
+ [groupId: string]: boolean;
68
+ };
69
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
70
+ multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
+ newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
72
+ isBindingEnabled: boolean;
73
+ isMidpointSnappingEnabled: boolean;
74
+ suggestedBinding: {
75
+ element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
76
+ midPoint?: import("@excalidraw/math").GlobalPoint;
77
+ } | null;
78
+ isRotating: boolean;
79
+ elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
80
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
81
+ snapLines: readonly import("../snapping").SnapLine[];
82
+ zenModeEnabled: boolean;
83
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
84
+ isCropping: boolean;
85
+ croppingElementId: ExcalidrawElement["id"] | null;
86
+ searchMatches: Readonly<{
87
+ focusedId: ExcalidrawElement["id"] | null;
88
+ matches: readonly import("../types").SearchMatch[];
89
+ }> | null;
90
+ activeLockedId: string | null;
91
+ hoveredElementIds: Readonly<{
92
+ [id: string]: true;
93
+ }>;
94
+ shouldCacheIgnoreZoom: boolean;
95
+ exportScale: number;
96
+ currentItemArrowType: "sharp" | "round" | "elbow";
97
+ bindMode: import("@excalidraw/element/types").BindMode;
98
+ gridSize: number;
99
+ contextMenu: {
100
+ items: import("../components/ContextMenu").ContextMenuItems;
101
+ top: number;
102
+ left: number;
103
+ } | null;
104
+ showWelcomeScreen: boolean;
105
+ isLoading: boolean;
106
+ errorMessage: React.ReactNode;
107
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
108
+ boxSelectionMode: import("../types").BoxSelectionMode;
109
+ bindingPreference: "enabled" | "disabled";
110
+ startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
111
+ editingFrame: string | null;
112
+ preferredSelectionTool: {
113
+ type: "selection" | "lasso";
114
+ initialized: boolean;
115
+ };
116
+ penMode: boolean;
117
+ penDetected: boolean;
118
+ exportBackground: boolean;
119
+ exportEmbedScene: boolean;
120
+ exportWithDarkMode: boolean;
121
+ currentItemStrokeColor: string;
122
+ currentItemBackgroundColor: string;
123
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
124
+ currentItemStrokeWidth: number;
125
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
126
+ currentItemRoughness: number;
127
+ currentItemOpacity: number;
128
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
129
+ currentItemFontSize: number;
130
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
131
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
132
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
133
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
134
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
135
+ cursorButton: "up" | "down";
136
+ scrolledOutside: boolean;
137
+ isResizing: boolean;
138
+ openMenu: "canvas" | null;
139
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
140
+ openSidebar: {
141
+ name: import("../types").SidebarName;
142
+ tab?: import("../types").SidebarTabName;
143
+ } | null;
144
+ defaultSidebarDockedPreference: boolean;
145
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
146
+ previousSelectedElementIds: {
147
+ [id: string]: true;
148
+ };
149
+ selectedElementsAreBeingDragged: boolean;
150
+ toast: {
151
+ message: React.ReactNode;
152
+ closable?: boolean;
153
+ duration?: number;
154
+ } | null;
155
+ gridStep: number;
156
+ gridModeEnabled: boolean;
157
+ fileHandle: FileSystemFileHandle | null;
158
+ stats: {
159
+ open: boolean;
160
+ panels: number;
161
+ };
162
+ showHyperlinkPopup: false | "info" | "editor";
163
+ originSnapOffset: {
164
+ x: number;
165
+ y: number;
166
+ } | null;
167
+ objectsSnapModeEnabled: boolean;
168
+ userToFollow: import("../types").UserToFollow | null;
169
+ followedBy: Set<import("../types").SocketId>;
170
+ lockedMultiSelections: {
171
+ [groupId: string]: true;
172
+ };
173
+ };
174
+ files: BinaryFiles;
7
175
  }>;
8
- export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<import("./restore").RestoredDataState>;
9
176
  export declare const isValidExcalidrawData: (data?: {
10
177
  type?: any;
11
178
  elements?: any;