@nous-excalidraw/element 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/README.md +19 -0
  2. package/dist/dev/index.js +22308 -0
  3. package/dist/dev/index.js.map +7 -0
  4. package/dist/prod/index.js +28 -0
  5. package/dist/types/common/debug.d.ts +21 -0
  6. package/dist/types/common/src/appEventBus.d.ts +27 -0
  7. package/dist/types/common/src/binary-heap.d.ts +12 -0
  8. package/dist/types/common/src/bounds.d.ts +10 -0
  9. package/dist/types/common/src/colors.d.ts +82 -0
  10. package/dist/types/common/src/constants.d.ts +357 -0
  11. package/dist/types/common/src/editorInterface.d.ts +34 -0
  12. package/dist/types/common/src/emitter.d.ts +16 -0
  13. package/dist/types/common/src/font-metadata.d.ts +46 -0
  14. package/dist/types/common/src/index.d.ts +17 -0
  15. package/dist/types/common/src/keys.d.ts +189 -0
  16. package/dist/types/common/src/points.d.ts +9 -0
  17. package/dist/types/common/src/promise-pool.d.ts +6 -0
  18. package/dist/types/common/src/queue.d.ts +9 -0
  19. package/dist/types/common/src/random.d.ts +3 -0
  20. package/dist/types/common/src/url.d.ts +7 -0
  21. package/dist/types/common/src/utility-types.d.ts +37 -0
  22. package/dist/types/common/src/utils.d.ts +279 -0
  23. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  24. package/dist/types/element/src/Scene.d.ts +82 -0
  25. package/dist/types/element/src/align.d.ts +8 -0
  26. package/dist/types/element/src/arrowheads.d.ts +3 -0
  27. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  28. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  29. package/dist/types/element/src/binding.d.ts +129 -0
  30. package/dist/types/element/src/bounds.d.ts +83 -0
  31. package/dist/types/element/src/collision.d.ts +37 -0
  32. package/dist/types/element/src/comparisons.d.ts +8 -0
  33. package/dist/types/element/src/containerCache.d.ts +11 -0
  34. package/dist/types/element/src/cropElement.d.ts +19 -0
  35. package/dist/types/element/src/delta.d.ts +228 -0
  36. package/dist/types/element/src/distance.d.ts +3 -0
  37. package/dist/types/element/src/distribute.d.ts +8 -0
  38. package/dist/types/element/src/dragElements.d.ts +33 -0
  39. package/dist/types/element/src/duplicate.d.ts +63 -0
  40. package/dist/types/element/src/elbowArrow.d.ts +19 -0
  41. package/dist/types/element/src/elementLink.d.ts +13 -0
  42. package/dist/types/element/src/embeddable.d.ts +10 -0
  43. package/dist/types/element/src/flowchart.d.ts +26 -0
  44. package/dist/types/element/src/fractionalIndex.d.ts +57 -0
  45. package/dist/types/element/src/frame.d.ts +74 -0
  46. package/dist/types/element/src/groups.d.ts +34 -0
  47. package/dist/types/element/src/heading.d.ts +16 -0
  48. package/dist/types/element/src/image.d.ts +22 -0
  49. package/dist/types/element/src/index.d.ts +59 -0
  50. package/dist/types/element/src/linearElementEditor.d.ts +118 -0
  51. package/dist/types/element/src/mutateElement.d.ts +25 -0
  52. package/dist/types/element/src/newElement.d.ts +62 -0
  53. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  54. package/dist/types/element/src/renderElement.d.ts +25 -0
  55. package/dist/types/element/src/resizeElements.d.ts +32 -0
  56. package/dist/types/element/src/resizeTest.d.ts +16 -0
  57. package/dist/types/element/src/selection.d.ts +38 -0
  58. package/dist/types/element/src/shape.d.ts +43 -0
  59. package/dist/types/element/src/showSelectedShapeActions.d.ts +3 -0
  60. package/dist/types/element/src/sizeHelpers.d.ts +35 -0
  61. package/dist/types/element/src/sortElements.d.ts +2 -0
  62. package/dist/types/element/src/store.d.ts +237 -0
  63. package/dist/types/element/src/textElement.d.ts +40 -0
  64. package/dist/types/element/src/textMeasurements.d.ts +39 -0
  65. package/dist/types/element/src/textWrapping.d.ts +39 -0
  66. package/dist/types/element/src/transform.d.ts +81 -0
  67. package/dist/types/element/src/transformHandles.d.ts +36 -0
  68. package/dist/types/element/src/typeChecks.d.ts +54 -0
  69. package/dist/types/element/src/types.d.ts +294 -0
  70. package/dist/types/element/src/utils.d.ts +36 -0
  71. package/dist/types/element/src/visualdebug.d.ts +59 -0
  72. package/dist/types/element/src/zindex.d.ts +13 -0
  73. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +488 -0
  74. package/dist/types/excalidraw/actions/actionAlign.d.ts +109 -0
  75. package/dist/types/excalidraw/actions/actionBoundText.d.ts +362 -0
  76. package/dist/types/excalidraw/actions/actionCanvas.d.ts +2071 -0
  77. package/dist/types/excalidraw/actions/actionClipboard.d.ts +401 -0
  78. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +175 -0
  79. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +524 -0
  80. package/dist/types/excalidraw/actions/actionDeselect.d.ts +160 -0
  81. package/dist/types/excalidraw/actions/actionDistribute.d.ts +34 -0
  82. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +17 -0
  83. package/dist/types/excalidraw/actions/actionElementLink.d.ts +191 -0
  84. package/dist/types/excalidraw/actions/actionElementLock.d.ts +348 -0
  85. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +172 -0
  86. package/dist/types/excalidraw/actions/actionExport.d.ts +409 -0
  87. package/dist/types/excalidraw/actions/actionFinalize.d.ts +13 -0
  88. package/dist/types/excalidraw/actions/actionFlip.d.ts +34 -0
  89. package/dist/types/excalidraw/actions/actionFrame.d.ts +1154 -0
  90. package/dist/types/excalidraw/actions/actionGroup.d.ts +352 -0
  91. package/dist/types/excalidraw/actions/actionHistory.d.ts +6 -0
  92. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +662 -0
  93. package/dist/types/excalidraw/actions/actionLink.d.ts +176 -0
  94. package/dist/types/excalidraw/actions/actionMenu.d.ts +160 -0
  95. package/dist/types/excalidraw/actions/actionNavigate.d.ts +20 -0
  96. package/dist/types/excalidraw/actions/actionProperties.d.ts +404 -0
  97. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +171 -0
  98. package/dist/types/excalidraw/actions/actionStyles.d.ts +190 -0
  99. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
  100. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +173 -0
  101. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +178 -0
  102. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +173 -0
  103. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +176 -0
  104. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +163 -0
  105. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  106. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +175 -0
  107. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +176 -0
  108. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +176 -0
  109. package/dist/types/excalidraw/actions/actionZindex.d.ts +74 -0
  110. package/dist/types/excalidraw/actions/index.d.ts +31 -0
  111. package/dist/types/excalidraw/actions/manager.d.ts +21 -0
  112. package/dist/types/excalidraw/actions/register.d.ts +5 -0
  113. package/dist/types/excalidraw/actions/shortcuts.d.ts +4 -0
  114. package/dist/types/excalidraw/actions/types.d.ts +47 -0
  115. package/dist/types/excalidraw/analytics.d.ts +1 -0
  116. package/dist/types/excalidraw/animated-trail.d.ts +39 -0
  117. package/dist/types/excalidraw/animation-frame-handler.d.ts +16 -0
  118. package/dist/types/excalidraw/appState.d.ts +104 -0
  119. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  120. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  121. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  122. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  123. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  124. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  125. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  126. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  127. package/dist/types/excalidraw/clients.d.ts +14 -0
  128. package/dist/types/excalidraw/clipboard.d.ts +104 -0
  129. package/dist/types/excalidraw/components/Actions.d.ts +47 -0
  130. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +4 -0
  131. package/dist/types/excalidraw/components/App.d.ts +602 -0
  132. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  133. package/dist/types/excalidraw/components/Avatar.d.ts +11 -0
  134. package/dist/types/excalidraw/components/BraveMeasureTextError.d.ts +2 -0
  135. package/dist/types/excalidraw/components/Button.d.ts +17 -0
  136. package/dist/types/excalidraw/components/ButtonIcon.d.ts +16 -0
  137. package/dist/types/excalidraw/components/ButtonSeparator.d.ts +1 -0
  138. package/dist/types/excalidraw/components/Card.d.ts +5 -0
  139. package/dist/types/excalidraw/components/CheckboxItem.d.ts +8 -0
  140. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +8 -0
  141. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +22 -0
  142. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +8 -0
  143. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +7 -0
  144. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +19 -0
  145. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +10 -0
  146. package/dist/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +5 -0
  147. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +9 -0
  148. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +9 -0
  149. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +20 -0
  150. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
  151. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +19 -0
  152. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -0
  153. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +24 -0
  154. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +10 -0
  155. package/dist/types/excalidraw/components/ContextMenu.d.ts +16 -0
  156. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  157. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +7 -0
  158. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +27 -0
  159. package/dist/types/excalidraw/components/Dialog.d.ts +13 -0
  160. package/dist/types/excalidraw/components/DialogActionButton.d.ts +10 -0
  161. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +7 -0
  162. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +12 -0
  163. package/dist/types/excalidraw/components/Ellipsify.d.ts +3 -0
  164. package/dist/types/excalidraw/components/ErrorDialog.d.ts +5 -0
  165. package/dist/types/excalidraw/components/EyeDropper.d.ts +27 -0
  166. package/dist/types/excalidraw/components/FilledButton.d.ts +19 -0
  167. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +9 -0
  168. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +10 -0
  169. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +22 -0
  170. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +26 -0
  171. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +8 -0
  172. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +13 -0
  173. package/dist/types/excalidraw/components/HandButton.d.ts +10 -0
  174. package/dist/types/excalidraw/components/HelpButton.d.ts +7 -0
  175. package/dist/types/excalidraw/components/HelpDialog.d.ts +4 -0
  176. package/dist/types/excalidraw/components/HintViewer.d.ts +11 -0
  177. package/dist/types/excalidraw/components/IconPicker.d.ts +20 -0
  178. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +14 -0
  179. package/dist/types/excalidraw/components/InlineIcon.d.ts +5 -0
  180. package/dist/types/excalidraw/components/Island.d.ts +10 -0
  181. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +15 -0
  182. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +10 -0
  183. package/dist/types/excalidraw/components/LayerUI.d.ts +32 -0
  184. package/dist/types/excalidraw/components/LibraryMenu.d.ts +10 -0
  185. package/dist/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +7 -0
  186. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +9 -0
  187. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +17 -0
  188. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +14 -0
  189. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +23 -0
  190. package/dist/types/excalidraw/components/LibraryUnit.d.ts +14 -0
  191. package/dist/types/excalidraw/components/LoadingMessage.d.ts +5 -0
  192. package/dist/types/excalidraw/components/LockButton.d.ts +10 -0
  193. package/dist/types/excalidraw/components/MagicButton.d.ts +10 -0
  194. package/dist/types/excalidraw/components/MobileMenu.d.ts +23 -0
  195. package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  196. package/dist/types/excalidraw/components/Modal.d.ts +11 -0
  197. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  198. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  199. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  200. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +7 -0
  201. package/dist/types/excalidraw/components/PenModeButton.d.ts +12 -0
  202. package/dist/types/excalidraw/components/Popover.d.ts +16 -0
  203. package/dist/types/excalidraw/components/ProjectName.d.ts +10 -0
  204. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +16 -0
  205. package/dist/types/excalidraw/components/PublishLibrary.d.ts +16 -0
  206. package/dist/types/excalidraw/components/QuickSearch.d.ts +9 -0
  207. package/dist/types/excalidraw/components/RadioGroup.d.ts +13 -0
  208. package/dist/types/excalidraw/components/RadioSelection.d.ts +20 -0
  209. package/dist/types/excalidraw/components/Range.d.ts +14 -0
  210. package/dist/types/excalidraw/components/SVGLayer.d.ts +7 -0
  211. package/dist/types/excalidraw/components/ScrollableList.d.ts +8 -0
  212. package/dist/types/excalidraw/components/SearchMenu.d.ts +5 -0
  213. package/dist/types/excalidraw/components/Section.d.ts +6 -0
  214. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +70 -0
  215. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +7 -0
  216. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +8 -0
  217. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
  218. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
  219. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +6 -0
  220. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +6 -0
  221. package/dist/types/excalidraw/components/Sidebar/common.d.ts +34 -0
  222. package/dist/types/excalidraw/components/Spinner.d.ts +8 -0
  223. package/dist/types/excalidraw/components/Stack.d.ts +15 -0
  224. package/dist/types/excalidraw/components/Stats/Angle.d.ts +11 -0
  225. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +10 -0
  226. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +10 -0
  227. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +11 -0
  228. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +44 -0
  229. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +11 -0
  230. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +11 -0
  231. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +14 -0
  232. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +12 -0
  233. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +14 -0
  234. package/dist/types/excalidraw/components/Stats/Position.d.ts +12 -0
  235. package/dist/types/excalidraw/components/Stats/index.d.ts +35 -0
  236. package/dist/types/excalidraw/components/Stats/utils.d.ts +19 -0
  237. package/dist/types/excalidraw/components/Switch.d.ts +9 -0
  238. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  239. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  240. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  241. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  242. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  243. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  244. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  245. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +7 -0
  246. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  247. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +13 -0
  248. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +9 -0
  249. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +11 -0
  250. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +21 -0
  251. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
  252. package/dist/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -0
  253. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +7 -0
  254. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -0
  255. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -0
  256. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +11 -0
  257. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  258. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  259. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  260. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +33 -0
  261. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  262. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  263. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  264. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  265. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  266. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  267. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  268. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  269. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  270. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  271. package/dist/types/excalidraw/components/TextField.d.ts +22 -0
  272. package/dist/types/excalidraw/components/Toast.d.ts +13 -0
  273. package/dist/types/excalidraw/components/ToolButton.d.ts +49 -0
  274. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  275. package/dist/types/excalidraw/components/Tooltip.d.ts +18 -0
  276. package/dist/types/excalidraw/components/Trans.d.ts +9 -0
  277. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  278. package/dist/types/excalidraw/components/UserList.d.ts +18 -0
  279. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +34 -0
  280. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +14 -0
  281. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +19 -0
  282. package/dist/types/excalidraw/components/canvases/index.d.ts +3 -0
  283. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +98 -0
  284. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +17 -0
  285. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  286. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +37 -0
  287. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  288. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +9 -0
  289. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +18 -0
  290. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
  291. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +16 -0
  292. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  293. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  294. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  295. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  296. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
  297. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +6 -0
  298. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +5 -0
  299. package/dist/types/excalidraw/components/footer/Footer.d.ts +12 -0
  300. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +4 -0
  301. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +19 -0
  302. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +10 -0
  303. package/dist/types/excalidraw/components/icons.d.ts +253 -0
  304. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +82 -0
  305. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +87 -0
  306. package/dist/types/excalidraw/components/shapes.d.ts +263 -0
  307. package/dist/types/excalidraw/context/tunnels.d.ts +21 -0
  308. package/dist/types/excalidraw/context/ui-appState.d.ts +4 -0
  309. package/dist/types/excalidraw/cursor.d.ts +5 -0
  310. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +8 -0
  311. package/dist/types/excalidraw/data/blob.d.ts +370 -0
  312. package/dist/types/excalidraw/data/encode.d.ts +55 -0
  313. package/dist/types/excalidraw/data/encryption.d.ts +9 -0
  314. package/dist/types/excalidraw/data/filesystem.d.ts +19 -0
  315. package/dist/types/excalidraw/data/image.d.ts +9 -0
  316. package/dist/types/excalidraw/data/index.d.ts +21 -0
  317. package/dist/types/excalidraw/data/json.d.ts +183 -0
  318. package/dist/types/excalidraw/data/library.d.ts +127 -0
  319. package/dist/types/excalidraw/data/resave.d.ts +10 -0
  320. package/dist/types/excalidraw/data/restore.d.ts +41 -0
  321. package/dist/types/excalidraw/data/types.d.ts +48 -0
  322. package/dist/types/excalidraw/deburr.d.ts +1 -0
  323. package/dist/types/excalidraw/editor-jotai.d.ts +56 -0
  324. package/dist/types/excalidraw/eraser/index.d.ts +12 -0
  325. package/dist/types/excalidraw/errors.d.ts +43 -0
  326. package/dist/types/excalidraw/fonts/Cascadia/index.d.ts +2 -0
  327. package/dist/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  328. package/dist/types/excalidraw/fonts/Emoji/index.d.ts +2 -0
  329. package/dist/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +25 -0
  330. package/dist/types/excalidraw/fonts/Excalifont/index.d.ts +2 -0
  331. package/dist/types/excalidraw/fonts/Fonts.d.ts +79 -0
  332. package/dist/types/excalidraw/fonts/Helvetica/index.d.ts +2 -0
  333. package/dist/types/excalidraw/fonts/Liberation/index.d.ts +2 -0
  334. package/dist/types/excalidraw/fonts/Lilita/index.d.ts +2 -0
  335. package/dist/types/excalidraw/fonts/Nunito/index.d.ts +2 -0
  336. package/dist/types/excalidraw/fonts/Virgil/index.d.ts +2 -0
  337. package/dist/types/excalidraw/fonts/Xiaolai/index.d.ts +8 -0
  338. package/dist/types/excalidraw/fonts/index.d.ts +1 -0
  339. package/dist/types/excalidraw/gesture.d.ts +6 -0
  340. package/dist/types/excalidraw/history.d.ts +48 -0
  341. package/dist/types/excalidraw/hooks/useCallbackRefState.d.ts +1 -0
  342. package/dist/types/excalidraw/hooks/useCopiedIndicator.d.ts +5 -0
  343. package/dist/types/excalidraw/hooks/useCreatePortalContainer.d.ts +4 -0
  344. package/dist/types/excalidraw/hooks/useEmitter.d.ts +2 -0
  345. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +11 -0
  346. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +21 -0
  347. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -0
  348. package/dist/types/excalidraw/hooks/useStable.d.ts +1 -0
  349. package/dist/types/excalidraw/hooks/useStableCallback.d.ts +4 -0
  350. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  351. package/dist/types/excalidraw/hooks/useTransition.d.ts +2 -0
  352. package/dist/types/excalidraw/i18n.d.ts +24 -0
  353. package/dist/types/excalidraw/laser-trails.d.ts +20 -0
  354. package/dist/types/excalidraw/lasso/index.d.ts +16 -0
  355. package/dist/types/excalidraw/lasso/utils.d.ts +13 -0
  356. package/dist/types/excalidraw/mermaid.d.ts +2 -0
  357. package/dist/types/excalidraw/reactUtils.d.ts +14 -0
  358. package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
  359. package/dist/types/excalidraw/renderer/helpers.d.ts +16 -0
  360. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +14 -0
  361. package/dist/types/excalidraw/renderer/renderNewElementScene.d.ts +7 -0
  362. package/dist/types/excalidraw/renderer/renderSnaps.d.ts +2 -0
  363. package/dist/types/excalidraw/renderer/roundRect.d.ts +11 -0
  364. package/dist/types/excalidraw/renderer/staticScene.d.ts +14 -0
  365. package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +5 -0
  366. package/dist/types/excalidraw/scene/Renderer.d.ts +30 -0
  367. package/dist/types/excalidraw/scene/export.d.ts +36 -0
  368. package/dist/types/excalidraw/scene/index.d.ts +4 -0
  369. package/dist/types/excalidraw/scene/normalize.d.ts +4 -0
  370. package/dist/types/excalidraw/scene/scroll.d.ts +18 -0
  371. package/dist/types/excalidraw/scene/scrollbars.d.ts +11 -0
  372. package/dist/types/excalidraw/scene/types.d.ts +137 -0
  373. package/dist/types/excalidraw/scene/zoom.d.ts +12 -0
  374. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  375. package/dist/types/excalidraw/snapping.d.ts +111 -0
  376. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +45 -0
  377. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +13 -0
  378. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +2 -0
  379. package/dist/types/excalidraw/subset/subset-main.d.ts +12 -0
  380. package/dist/types/excalidraw/subset/subset-shared.chunk.d.ts +32 -0
  381. package/dist/types/excalidraw/subset/subset-worker.chunk.d.ts +15 -0
  382. package/dist/types/excalidraw/subset/woff2/woff2-bindings.d.ts +31 -0
  383. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +14 -0
  384. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +2 -0
  385. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  386. package/dist/types/excalidraw/types.d.ts +798 -0
  387. package/dist/types/excalidraw/workers.d.ts +36 -0
  388. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +28 -0
  389. package/dist/types/math/src/angle.d.ts +19 -0
  390. package/dist/types/math/src/constants.d.ts +3 -0
  391. package/dist/types/math/src/curve.d.ts +77 -0
  392. package/dist/types/math/src/ellipse.d.ts +44 -0
  393. package/dist/types/math/src/index.d.ts +13 -0
  394. package/dist/types/math/src/line.d.ts +17 -0
  395. package/dist/types/math/src/point.d.ts +127 -0
  396. package/dist/types/math/src/polygon.d.ts +6 -0
  397. package/dist/types/math/src/range.d.ts +42 -0
  398. package/dist/types/math/src/rectangle.d.ts +5 -0
  399. package/dist/types/math/src/segment.d.ts +40 -0
  400. package/dist/types/math/src/triangle.d.ts +11 -0
  401. package/dist/types/math/src/types.d.ts +130 -0
  402. package/dist/types/math/src/utils.d.ts +7 -0
  403. package/dist/types/math/src/vector.d.ts +94 -0
  404. package/dist/types/utils/src/bbox.d.ts +9 -0
  405. package/dist/types/utils/src/export.d.ts +35 -0
  406. package/dist/types/utils/src/index.d.ts +4 -0
  407. package/dist/types/utils/src/shape.d.ts +58 -0
  408. package/dist/types/utils/src/withinBounds.d.ts +19 -0
  409. package/package.json +69 -0
@@ -0,0 +1,55 @@
1
+ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) => string;
2
+ /**
3
+ * @param isByteString set to true if already byte string to prevent bloat
4
+ * due to reencoding
5
+ */
6
+ export declare const stringToBase64: (str: string, isByteString?: boolean) => string;
7
+ export declare const base64ToString: (base64: string, isByteString?: boolean) => string;
8
+ export declare const base64ToArrayBuffer: (base64: string) => ArrayBuffer;
9
+ export declare const base64urlToString: (str: string) => string;
10
+ type EncodedData = {
11
+ encoded: string;
12
+ encoding: "bstring";
13
+ /** whether text is compressed (zlib) */
14
+ compressed: boolean;
15
+ /** version for potential migration purposes */
16
+ version?: string;
17
+ };
18
+ /**
19
+ * Encodes (and potentially compresses via zlib) text to byte string
20
+ */
21
+ export declare const encode: ({ text, compress, }: {
22
+ text: string;
23
+ /** defaults to `true`. If compression fails, falls back to bstring alone. */
24
+ compress?: boolean;
25
+ }) => EncodedData;
26
+ export declare const decode: (data: EncodedData) => string;
27
+ /**
28
+ * The returned buffer has following format:
29
+ * `[]` refers to a buffers wrapper (see `concatBuffers`)
30
+ *
31
+ * [
32
+ * encodingMetadataBuffer,
33
+ * iv,
34
+ * [
35
+ * contentsMetadataBuffer
36
+ * contentsBuffer
37
+ * ]
38
+ * ]
39
+ */
40
+ export declare const compressData: <T extends Record<string, any> = never>(dataBuffer: Uint8Array, options: {
41
+ encryptionKey: string;
42
+ } & ([T] extends [never] ? {
43
+ metadata?: T;
44
+ } : {
45
+ metadata: T;
46
+ })) => Promise<Uint8Array<ArrayBuffer>>;
47
+ export declare const decompressData: <T extends Record<string, any>>(bufferView: Uint8Array, options: {
48
+ decryptionKey: string;
49
+ }) => Promise<{
50
+ /** metadata source is always JSON so we can decode it here */
51
+ metadata: T;
52
+ /** data can be anything so the caller must decode it */
53
+ data: Uint8Array<ArrayBuffer>;
54
+ }>;
55
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const IV_LENGTH_BYTES = 12;
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
+ export declare const getCryptoKey: (key: string, usage: KeyUsage) => Promise<CryptoKey>;
5
+ export declare const encryptData: (key: string | CryptoKey, data: Uint8Array<ArrayBuffer> | ArrayBuffer | Blob | File | string) => Promise<{
6
+ encryptedBuffer: ArrayBuffer;
7
+ iv: Uint8Array<ArrayBuffer>;
8
+ }>;
9
+ export declare const decryptData: (iv: Uint8Array<ArrayBuffer>, encrypted: Uint8Array<ArrayBuffer> | ArrayBuffer, privateKey: string) => Promise<ArrayBuffer>;
@@ -0,0 +1,19 @@
1
+ import { supported as nativeFileSystemSupported } from "browser-fs-access";
2
+ import { MIME_TYPES } from "@nous-excalidraw/common";
3
+ type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
4
+ export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
5
+ extensions?: FILE_EXTENSION[];
6
+ description: string;
7
+ multiple?: M;
8
+ }) => Promise<M extends false | undefined ? File : File[]>;
9
+ export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
10
+ /** supply without the extension */
11
+ name: string;
12
+ /** file extension */
13
+ extension: FILE_EXTENSION;
14
+ mimeTypes?: string[];
15
+ description: string;
16
+ /** existing FileSystemFileHandle */
17
+ fileHandle?: FileSystemFileHandle | null;
18
+ }) => Promise<FileSystemFileHandle | null>;
19
+ export { nativeFileSystemSupported };
@@ -0,0 +1,9 @@
1
+ export declare const getTEXtChunk: (blob: Blob) => Promise<{
2
+ keyword: string;
3
+ text: string;
4
+ } | null>;
5
+ export declare const encodePngMetadata: ({ blob, metadata, }: {
6
+ blob: Blob;
7
+ metadata: string;
8
+ }) => Promise<Blob>;
9
+ export declare const decodePngMetadata: (blob: Blob) => Promise<string>;
@@ -0,0 +1,21 @@
1
+ import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@nous-excalidraw/element/types";
2
+ import type { ExportType } from "../scene/types";
3
+ import type { AppState, BinaryFiles } from "../types";
4
+ export { loadFromBlob } from "./blob";
5
+ export { loadFromJSON, saveAsJSON } from "./json";
6
+ export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
7
+ _brand: "exportedElements";
8
+ };
9
+ export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
10
+ exportingFrame: ExcalidrawFrameLikeElement | null;
11
+ exportedElements: ExportedElements;
12
+ };
13
+ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
14
+ exportBackground: boolean;
15
+ exportPadding?: number;
16
+ viewBackgroundColor: string;
17
+ /** filename, if applicable */
18
+ name?: string;
19
+ fileHandle?: FileSystemFileHandle | null;
20
+ exportingFrame: ExcalidrawFrameLikeElement | null;
21
+ }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -0,0 +1,183 @@
1
+ import type { ExcalidrawElement, NonDeleted } from "@nous-excalidraw/element/types";
2
+ import type { MaybePromise } from "@nous-excalidraw/common/utility-types";
3
+ import type { AppState, BinaryFiles, LibraryItems } from "../types";
4
+ import type { ImportedDataState, ImportedLibraryData } from "./types";
5
+ export type JSONExportData = {
6
+ elements: readonly NonDeleted<ExcalidrawElement>[];
7
+ appState: AppState;
8
+ files: BinaryFiles;
9
+ };
10
+ export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
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("@nous-excalidraw/element/types").OrderedExcalidrawElement[];
20
+ appState: {
21
+ viewBackgroundColor: string;
22
+ theme: import("@nous-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("@nous-excalidraw/element/types").GroupId | null;
52
+ selectedElementIds: Readonly<{
53
+ [id: string]: true;
54
+ }>;
55
+ frameToHighlight: NonDeleted<import("@nous-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("@nous-excalidraw/element/types").NonDeletedExcalidrawElement;
63
+ state: "hover" | "active";
64
+ } | null;
65
+ selectionElement: import("@nous-excalidraw/element/types").NonDeletedExcalidrawElement | null;
66
+ selectedGroupIds: {
67
+ [groupId: string]: boolean;
68
+ };
69
+ selectedLinearElement: import("@nous-excalidraw/element").LinearElementEditor | null;
70
+ multiElement: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawLinearElement> | null;
71
+ newElement: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
72
+ isBindingEnabled: boolean;
73
+ isMidpointSnappingEnabled: boolean;
74
+ suggestedBinding: {
75
+ element: NonDeleted<import("@nous-excalidraw/element/types").ExcalidrawBindableElement>;
76
+ midPoint?: import("@nous-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("@nous-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("@nous-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("@nous-excalidraw/element/types").NonDeletedExcalidrawElement | null;
108
+ boxSelectionMode: import("../types").BoxSelectionMode;
109
+ bindingPreference: "enabled" | "disabled";
110
+ startBoundElement: NonDeleted<import("@nous-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("@nous-excalidraw/element/types").FontFamilyValues;
129
+ currentItemFontSize: number;
130
+ currentItemTextAlign: import("@nous-excalidraw/element/types").TextAlign;
131
+ currentItemStartArrowhead: import("@nous-excalidraw/element/types").Arrowhead | null;
132
+ currentItemEndArrowhead: import("@nous-excalidraw/element/types").Arrowhead | null;
133
+ currentHoveredFontFamily: import("@nous-excalidraw/element/types").FontFamilyValues | null;
134
+ currentItemRoundness: import("@nous-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("@nous-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;
175
+ }>;
176
+ export declare const isValidExcalidrawData: (data?: {
177
+ type?: any;
178
+ elements?: any;
179
+ appState?: any;
180
+ }) => data is ImportedDataState;
181
+ export declare const isValidLibrary: (json: any) => json is ImportedLibraryData;
182
+ export declare const serializeLibraryAsJSON: (libraryItems: LibraryItems) => string;
183
+ export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
@@ -0,0 +1,127 @@
1
+ import type { ExcalidrawElement } from "@nous-excalidraw/element/types";
2
+ import type { MaybePromise } from "@nous-excalidraw/common/utility-types";
3
+ import type App from "../components/App";
4
+ import type { LibraryItems, ExcalidrawImperativeAPI, LibraryItemsSource, LibraryItems_anyVersion } from "../types";
5
+ export type LibraryPersistedData = {
6
+ libraryItems: LibraryItems;
7
+ };
8
+ export type LibraryAdatapterSource = "load" | "save";
9
+ export interface LibraryPersistenceAdapter {
10
+ /**
11
+ * Should load data that were previously saved into the database using the
12
+ * `save` method. Should throw if saving fails.
13
+ *
14
+ * Will be used internally in multiple places, such as during save to
15
+ * in order to reconcile changes with latest store data.
16
+ */
17
+ load(metadata: {
18
+ /**
19
+ * Indicates whether we're loading data for save purposes, or reading
20
+ * purposes, in which case host app can implement more aggressive caching.
21
+ */
22
+ source: LibraryAdatapterSource;
23
+ }): MaybePromise<{
24
+ libraryItems: LibraryItems_anyVersion;
25
+ } | null>;
26
+ /** Should persist to the database as is (do no change the data structure). */
27
+ save(libraryData: LibraryPersistedData): MaybePromise<void>;
28
+ }
29
+ export interface LibraryMigrationAdapter {
30
+ /**
31
+ * loads data from legacy data source. Returns `null` if no data is
32
+ * to be migrated.
33
+ */
34
+ load(): MaybePromise<{
35
+ libraryItems: LibraryItems_anyVersion;
36
+ } | null>;
37
+ /** clears entire storage afterwards */
38
+ clear(): MaybePromise<void>;
39
+ }
40
+ export declare const libraryItemsAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
41
+ status: "loading" | "loaded";
42
+ /** indicates whether library is initialized with library items (has gone
43
+ * through at least one update). Used in UI. Specific to this atom only. */
44
+ isInitialized: boolean;
45
+ libraryItems: LibraryItems;
46
+ }> & {
47
+ init: {
48
+ status: "loading" | "loaded";
49
+ /** indicates whether library is initialized with library items (has gone
50
+ * through at least one update). Used in UI. Specific to this atom only. */
51
+ isInitialized: boolean;
52
+ libraryItems: LibraryItems;
53
+ };
54
+ };
55
+ /** Merges otherItems into localItems. Unique items in otherItems array are
56
+ sorted first. */
57
+ export declare const mergeLibraryItems: (localItems: LibraryItems, otherItems: LibraryItems) => LibraryItems;
58
+ declare class Library {
59
+ /** latest libraryItems */
60
+ private currLibraryItems;
61
+ /** snapshot of library items since last onLibraryChange call */
62
+ private prevLibraryItems;
63
+ private app;
64
+ constructor(app: App);
65
+ private updateQueue;
66
+ private getLastUpdateTask;
67
+ private notifyListeners;
68
+ /** call on excalidraw instance unmount */
69
+ destroy: () => void;
70
+ resetLibrary: () => Promise<LibraryItems>;
71
+ /**
72
+ * @returns latest cloned libraryItems. Awaits all in-progress updates first.
73
+ */
74
+ getLatestLibrary: () => Promise<LibraryItems>;
75
+ updateLibrary: ({ libraryItems, prompt, merge, openLibraryMenu, defaultStatus, }: {
76
+ libraryItems: LibraryItemsSource;
77
+ merge?: boolean;
78
+ prompt?: boolean;
79
+ openLibraryMenu?: boolean;
80
+ defaultStatus?: "unpublished" | "published";
81
+ }) => 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>;
94
+ }
95
+ export default Library;
96
+ export declare const distributeLibraryItemsOnSquareGrid: (libraryItems: LibraryItems) => ExcalidrawElement[];
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;
102
+ export declare const parseLibraryTokensFromUrl: () => {
103
+ libraryUrl: string;
104
+ idToken: string | null;
105
+ } | null;
106
+ export declare const getLibraryItemsHash: (items: LibraryItems) => number;
107
+ export declare const useHandleLibrary: (opts: {
108
+ excalidrawAPI: ExcalidrawImperativeAPI | null;
109
+ /**
110
+ * Return `true` if the library install url should be allowed.
111
+ * If not supplied, only the excalidraw.com base domain is allowed.
112
+ */
113
+ validateLibraryUrl?: (libraryUrl: string) => boolean;
114
+ } & ({
115
+ /** @deprecated we recommend using `opts.adapter` instead */
116
+ getInitialLibraryItems?: () => MaybePromise<LibraryItemsSource>;
117
+ } | {
118
+ adapter: LibraryPersistenceAdapter;
119
+ /**
120
+ * Adapter that takes care of loading data from legacy data store.
121
+ * Supply this if you want to migrate data on initial load from legacy
122
+ * data store.
123
+ *
124
+ * Can be a different LibraryPersistenceAdapter.
125
+ */
126
+ migrationAdapter?: LibraryMigrationAdapter;
127
+ })) => void;
@@ -0,0 +1,10 @@
1
+ import type { MaybePromise } from "@nous-excalidraw/common/utility-types";
2
+ import type { ExcalidrawElement } from "@nous-excalidraw/element/types";
3
+ import type { AppState, BinaryFiles } from "../types";
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;
10
+ }>;
@@ -0,0 +1,41 @@
1
+ import { type CombineBrandsIfNeeded } from "@nous-excalidraw/common";
2
+ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawSelectionElement, OrderedExcalidrawElement } from "@nous-excalidraw/element/types";
3
+ import type { AppState, BinaryFiles, LibraryItem } from "../types";
4
+ import type { ImportedDataState } from "./types";
5
+ type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
6
+ export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
7
+ export type RestoredDataState = {
8
+ elements: OrderedExcalidrawElement[];
9
+ appState: RestoredAppState;
10
+ files: BinaryFiles;
11
+ };
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?: {
19
+ deleteInvisibleElements?: boolean;
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?: {
24
+ refreshDimensions?: boolean;
25
+ repairBindings?: boolean;
26
+ deleteInvisibleElements?: boolean;
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[];
39
+ export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
40
+ export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
41
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { VERSIONS } from "@nous-excalidraw/common";
2
+ import type { ExcalidrawElement } from "@nous-excalidraw/element/types";
3
+ import type { cleanAppStateForExport } from "../appState";
4
+ import type { AppState, BinaryFiles, LibraryItem, LibraryItems, LibraryItems_anyVersion } from "../types";
5
+ export interface ExportedDataState {
6
+ type: string;
7
+ version: number;
8
+ source: string;
9
+ elements: readonly ExcalidrawElement[];
10
+ appState: ReturnType<typeof cleanAppStateForExport>;
11
+ files: BinaryFiles | undefined;
12
+ }
13
+ /**
14
+ * Map of legacy AppState keys, with values of:
15
+ * [<legacy type>, <new AppState proeprty>]
16
+ *
17
+ * This is a helper type used in downstream abstractions.
18
+ * Don't consume on its own.
19
+ */
20
+ export type LegacyAppState = {
21
+ /** @deprecated #6213 TODO remove 23-06-01 */
22
+ isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
23
+ };
24
+ export interface ImportedDataState {
25
+ type?: string;
26
+ version?: number;
27
+ source?: string;
28
+ elements?: readonly ExcalidrawElement[] | null;
29
+ appState?: Readonly<Partial<AppState & {
30
+ [T in keyof LegacyAppState]: LegacyAppState[T][0];
31
+ }>> | null;
32
+ scrollToContent?: boolean;
33
+ libraryItems?: LibraryItems_anyVersion;
34
+ files?: BinaryFiles;
35
+ }
36
+ export interface ExportedLibraryData {
37
+ type: string;
38
+ version: typeof VERSIONS.excalidrawLibrary;
39
+ source: string;
40
+ libraryItems: LibraryItems;
41
+ }
42
+ export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
43
+ /** @deprecated v1 */
44
+ library?: LibraryItems;
45
+ }
46
+ export type ExcalidrawLibraryIds = {
47
+ itemIds: LibraryItem["id"][];
48
+ };
@@ -0,0 +1 @@
1
+ export declare const deburr: (str: string) => string;
@@ -0,0 +1,56 @@
1
+ import { atom, createStore, type PrimitiveAtom, type WritableAtom } from "jotai";
2
+ import { createIsolation } from "jotai-scope";
3
+ export { atom, PrimitiveAtom, WritableAtom };
4
+ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof import("jotai").useSetAtom, useAtomValue: typeof import("jotai").useAtomValue, useStore: (options?: {
5
+ store?: {
6
+ get: <Value>(atom: import("jotai").Atom<Value>) => Value;
7
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
8
+ sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
9
+ } | ({
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
+ sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
13
+ } & {
14
+ dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
15
+ readonly d: Map<import("jotai").Atom<unknown>, number>;
16
+ readonly p: Set<import("jotai").Atom<unknown>>;
17
+ n: number;
18
+ m?: {
19
+ readonly l: Set<() => void>;
20
+ readonly d: Set<import("jotai").Atom<unknown>>;
21
+ readonly t: Set<import("jotai").Atom<unknown>>;
22
+ u?: () => void;
23
+ };
24
+ v?: unknown;
25
+ e?: unknown;
26
+ }>;
27
+ dev4_get_mounted_atoms: () => Set<import("jotai").Atom<unknown>>;
28
+ dev4_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
29
+ });
30
+ } | undefined) => {
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
+ sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
34
+ } | ({
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
+ sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
38
+ } & {
39
+ dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
40
+ readonly d: Map<import("jotai").Atom<unknown>, number>;
41
+ readonly p: Set<import("jotai").Atom<unknown>>;
42
+ n: number;
43
+ m?: {
44
+ readonly l: Set<() => void>;
45
+ readonly d: Set<import("jotai").Atom<unknown>>;
46
+ readonly t: Set<import("jotai").Atom<unknown>>;
47
+ u?: () => void;
48
+ };
49
+ v?: unknown;
50
+ e?: unknown;
51
+ }>;
52
+ dev4_get_mounted_atoms: () => Set<import("jotai").Atom<unknown>>;
53
+ dev4_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
54
+ });
55
+ export declare const EditorJotaiProvider: ReturnType<typeof createIsolation>["Provider"];
56
+ export declare const editorJotaiStore: ReturnType<typeof createStore>;
@@ -0,0 +1,12 @@
1
+ import { AnimatedTrail } from "../animated-trail";
2
+ import type { AnimationFrameHandler } from "../animation-frame-handler";
3
+ import type App from "../components/App";
4
+ export declare class EraserTrail extends AnimatedTrail {
5
+ private elementsToErase;
6
+ private groupsToErase;
7
+ constructor(animationFrameHandler: AnimationFrameHandler, app: App);
8
+ startPath(x: number, y: number): void;
9
+ addPointToPath(x: number, y: number, restore?: boolean): string[];
10
+ private updateElementsToBeErased;
11
+ endPath(): void;
12
+ }
@@ -0,0 +1,43 @@
1
+ type CANVAS_ERROR_NAMES = "CANVAS_ERROR" | "CANVAS_POSSIBLY_TOO_BIG";
2
+ export declare class CanvasError extends Error {
3
+ constructor(message?: string, name?: CANVAS_ERROR_NAMES);
4
+ }
5
+ export declare class AbortError extends DOMException {
6
+ constructor(message?: string);
7
+ }
8
+ type ImageSceneDataErrorCode = "IMAGE_NOT_CONTAINS_SCENE_DATA" | "IMAGE_SCENE_DATA_ERROR";
9
+ export declare class ImageSceneDataError extends Error {
10
+ code: ImageSceneDataErrorCode;
11
+ constructor(message?: string, code?: ImageSceneDataErrorCode);
12
+ }
13
+ type WorkerErrorCodes = "WORKER_URL_NOT_DEFINED" | "WORKER_IN_THE_MAIN_CHUNK";
14
+ export declare class WorkerUrlNotDefinedError extends Error {
15
+ code: WorkerErrorCodes;
16
+ constructor(message?: string, code?: WorkerErrorCodes);
17
+ }
18
+ export declare class WorkerInTheMainChunkError extends Error {
19
+ code: WorkerErrorCodes;
20
+ constructor(message?: string, code?: WorkerErrorCodes);
21
+ }
22
+ /**
23
+ * Use this for generic, handled errors, so you can check against them
24
+ * and rethrow if needed
25
+ */
26
+ export declare class ExcalidrawError extends Error {
27
+ constructor(message: string);
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
+ }
43
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const CascadiaFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const ComicShannsFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const EmojiFontFaces: ExcalidrawFontFaceDescriptor[];