@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
@@ -1,13 +1,13 @@
1
1
  import { ALLOWED_PASTE_MIME_TYPES } from "@excalidraw/common";
2
+ import type { ValueOf } from "@excalidraw/common/utility-types";
3
+ import type { IMAGE_MIME_TYPES, STRING_MIME_TYPES } from "@excalidraw/common";
2
4
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
- import type { Spreadsheet } from "./charts";
4
5
  import type { BinaryFiles } from "./types";
5
6
  export type PastedMixedContent = {
6
7
  type: "text" | "imageUrl";
7
8
  value: string;
8
9
  }[];
9
10
  export interface ClipboardData {
10
- spreadsheet?: Spreadsheet;
11
11
  elements?: readonly ExcalidrawElement[];
12
12
  files?: BinaryFiles;
13
13
  text?: string;
@@ -20,26 +20,16 @@ export declare const probablySupportsClipboardReadText: boolean;
20
20
  export declare const probablySupportsClipboardWriteText: boolean;
21
21
  export declare const probablySupportsClipboardBlob: boolean;
22
22
  export declare const createPasteEvent: ({ types, files, }: {
23
- types?: {
24
- "text/plain"?: string | File | undefined;
25
- "text/html"?: string | File | undefined;
26
- "image/svg+xml"?: string | File | undefined;
27
- "image/png"?: string | File | undefined;
28
- "image/jpeg"?: string | File | undefined;
29
- "image/gif"?: string | File | undefined;
30
- "image/webp"?: string | File | undefined;
31
- "image/bmp"?: string | File | undefined;
32
- "image/x-icon"?: string | File | undefined;
33
- "image/avif"?: string | File | undefined;
34
- "image/jfif"?: string | File | undefined;
35
- } | undefined;
36
- files?: File[] | undefined;
23
+ types?: { [key in AllowedPasteMimeTypes]?: string | File; };
24
+ files?: File[];
37
25
  }) => ClipboardEvent;
38
26
  export declare const serializeAsClipboardJSON: ({ elements, files, }: {
39
27
  elements: readonly NonDeletedExcalidrawElement[];
40
28
  files: BinaryFiles | null;
41
29
  }) => string;
42
- export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
30
+ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null,
31
+ /** supply if available to make the operation more certain to succeed */
32
+ clipboardEvent?: ClipboardEvent | null) => Promise<void>;
43
33
  /**
44
34
  * Reads OS clipboard programmatically. May not work on all browsers.
45
35
  * Will prompt user for permission if not granted.
@@ -57,10 +47,58 @@ export declare const readSystemClipboard: () => Promise<{
57
47
  "image/avif"?: string | File | undefined;
58
48
  "image/jfif"?: string | File | undefined;
59
49
  }>;
50
+ type AllowedParsedDataTransferItem = {
51
+ type: ValueOf<typeof IMAGE_MIME_TYPES>;
52
+ kind: "file";
53
+ file: File;
54
+ fileHandle: FileSystemFileHandle | null;
55
+ } | {
56
+ type: ValueOf<typeof STRING_MIME_TYPES>;
57
+ kind: "string";
58
+ value: string;
59
+ };
60
+ type ParsedDataTransferItem = {
61
+ type: string;
62
+ kind: "file";
63
+ file: File;
64
+ fileHandle: FileSystemFileHandle | null;
65
+ } | {
66
+ type: string;
67
+ kind: "string";
68
+ value: string;
69
+ };
70
+ type ParsedDataTransferItemType<T extends AllowedParsedDataTransferItem["type"]> = AllowedParsedDataTransferItem & {
71
+ type: T;
72
+ };
73
+ export type ParsedDataTransferFile = Extract<AllowedParsedDataTransferItem, {
74
+ kind: "file";
75
+ }>;
76
+ export type ParsedDataTranferList = ParsedDataTransferItem[] & {
77
+ /**
78
+ * Only allows filtering by known `string` data types, since `file`
79
+ * types can have multiple items of the same type (e.g. multiple image files)
80
+ * unlike `string` data transfer items.
81
+ */
82
+ findByType: typeof findDataTransferItemType;
83
+ /**
84
+ * Only allows filtering by known `string` data types, since `file`
85
+ * types can have multiple items of the same type (e.g. multiple image files)
86
+ * unlike `string` data transfer items.
87
+ */
88
+ getData: typeof getDataTransferItemData;
89
+ getFiles: typeof getDataTransferFiles;
90
+ };
91
+ declare const findDataTransferItemType: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
92
+ declare const getDataTransferItemData: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
93
+ declare const getDataTransferFiles: (this: ParsedDataTranferList) => ParsedDataTransferFile[];
94
+ /** @returns list of MIME types, synchronously */
95
+ export declare const parseDataTransferEventMimeTypes: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Set<string>;
96
+ export declare const parseDataTransferEvent: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Promise<ParsedDataTranferList>;
60
97
  /**
61
98
  * Attempts to parse clipboard event.
62
99
  */
63
- export declare const parseClipboard: (event: ClipboardEvent, isPlainPaste?: boolean) => Promise<ClipboardData>;
100
+ export declare const parseClipboard: (dataList: ParsedDataTranferList, isPlainPaste?: boolean) => Promise<ClipboardData>;
64
101
  export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
65
- export declare const copyTextToSystemClipboard: (text: string | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
102
+ export declare const copyTextToSystemClipboard: <MimeType extends ValueOf<typeof STRING_MIME_TYPES>>(text: string | { [K in MimeType]: string; } | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
103
+ export declare const isClipboardEvent: (event: React.SyntheticEvent | Event) => event is ClipboardEvent;
66
104
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
2
  import "./Actions.scss";
3
- import type { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
3
+ import type { AppClassProperties, AppProps, UIAppState, Zoom, AppState } from "../types";
4
4
  import type { ActionManager } from "../actions/manager";
5
5
  export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
6
6
  export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
@@ -10,9 +10,23 @@ export declare const SelectedShapeActions: ({ appState, elementsMap, renderActio
10
10
  renderAction: ActionManager["renderAction"];
11
11
  app: AppClassProperties;
12
12
  }) => import("react/jsx-runtime").JSX.Element;
13
- export declare const ShapesSwitcher: ({ activeTool, appState, app, UIOptions, }: {
14
- activeTool: UIAppState["activeTool"];
13
+ export declare const CompactShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
15
14
  appState: UIAppState;
15
+ elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
16
+ renderAction: ActionManager["renderAction"];
17
+ app: AppClassProperties;
18
+ setAppState: React.Component<any, AppState>["setState"];
19
+ }) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
21
+ appState: UIAppState;
22
+ elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
23
+ renderAction: ActionManager["renderAction"];
24
+ app: AppClassProperties;
25
+ setAppState: React.Component<any, AppState>["setState"];
26
+ }) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const ShapesSwitcher: ({ activeTool, setAppState, app, UIOptions, }: {
28
+ activeTool: UIAppState["activeTool"];
29
+ setAppState: React.Component<any, AppState>["setState"];
16
30
  app: AppClassProperties;
17
31
  UIOptions: AppProps["UIOptions"];
18
32
  }) => import("react/jsx-runtime").JSX.Element;
@@ -22,13 +36,12 @@ export declare const ZoomActions: ({ renderAction, zoom, }: {
22
36
  }) => import("react/jsx-runtime").JSX.Element;
23
37
  export declare const UndoRedoActions: ({ renderAction, className, }: {
24
38
  renderAction: ActionManager["renderAction"];
25
- className?: string | undefined;
39
+ className?: string;
26
40
  }) => import("react/jsx-runtime").JSX.Element;
27
- export declare const ExitZenModeAction: ({ actionManager, showExitZenModeBtn, }: {
41
+ export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
28
42
  actionManager: ActionManager;
29
43
  showExitZenModeBtn: boolean;
30
44
  }) => import("react/jsx-runtime").JSX.Element;
31
- export declare const FinalizeAction: ({ renderAction, className, }: {
32
- renderAction: ActionManager["renderAction"];
33
- className?: string | undefined;
45
+ export declare const ExitViewModeButton: ({ actionManager, }: {
46
+ actionManager: ActionManager;
34
47
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
3
- import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
4
- import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
2
+ import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
3
+ import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
+ import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
5
  import type { Mutable } from "@excalidraw/common/utility-types";
6
6
  import { ActionManager } from "../actions/manager";
7
7
  import { AnimationFrameHandler } from "../animation-frame-handler";
@@ -10,30 +10,48 @@ import { Fonts } from "../fonts";
10
10
  import { type WritableAtom } from "../editor-jotai";
11
11
  import { Renderer } from "../scene/Renderer";
12
12
  import { LaserTrails } from "../laser-trails";
13
+ import { isOverScrollBars } from "../scene/scrollbars";
13
14
  import { LassoTrail } from "../lasso";
14
15
  import { EraserTrail } from "../eraser";
16
+ import { type OnStateChange } from "./AppStateObserver";
15
17
  import type { ExportedElements } from "../data";
16
- import type { FileSystemHandle } from "../data/filesystem";
17
- import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
18
+ import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
18
19
  import type { RoughCanvas } from "roughjs/bin/canvas";
19
20
  import type { ActionResult } from "../actions/types";
21
+ declare const editorLifecycleEventBehavior: {
22
+ readonly "editor:mount": {
23
+ readonly cardinality: "once";
24
+ readonly replay: "last";
25
+ };
26
+ readonly "editor:initialize": {
27
+ readonly cardinality: "once";
28
+ readonly replay: "last";
29
+ };
30
+ readonly "editor:unmount": {
31
+ readonly cardinality: "once";
32
+ readonly replay: "last";
33
+ };
34
+ };
20
35
  export declare const ExcalidrawContainerContext: React.Context<{
21
36
  container: HTMLDivElement | null;
22
37
  id: string | null;
23
38
  }>;
39
+ export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
40
+ export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
24
41
  export declare const useApp: () => AppClassProperties;
25
42
  export declare const useAppProps: () => AppProps;
26
- export declare const useDevice: () => Readonly<{
27
- viewport: {
28
- isMobile: boolean;
29
- isLandscape: boolean;
30
- };
31
- editor: {
32
- isMobile: boolean;
33
- canFitSidebar: boolean;
34
- };
43
+ export declare const useEditorInterface: () => Readonly<{
44
+ formFactor: "phone" | "tablet" | "desktop";
45
+ desktopUIMode: "compact" | "full";
46
+ userAgent: Readonly<{
47
+ isMobileDevice: boolean;
48
+ platform: "ios" | "android" | "other" | "unknown";
49
+ }>;
35
50
  isTouchScreen: boolean;
51
+ canFitSidebar: boolean;
52
+ isLandscape: boolean;
36
53
  }>;
54
+ export declare const useStylesPanelMode: () => StylesPanelMode;
37
55
  export declare const useExcalidrawContainer: () => {
38
56
  container: HTMLDivElement | null;
39
57
  id: string | null;
@@ -42,20 +60,25 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
42
60
  export declare const useExcalidrawAppState: () => AppState;
43
61
  export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
44
62
  export declare const useExcalidrawActionManager: () => ActionManager;
63
+ /**
64
+ * Requires wrapping your component in <ExcalidrawAPIContext.Provider>
65
+ */
66
+ export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
45
67
  declare class App extends React.Component<AppProps, AppState> {
46
68
  canvas: AppClassProperties["canvas"];
47
69
  interactiveCanvas: AppClassProperties["interactiveCanvas"];
70
+ sessionExportThemeOverride: AppState["theme"] | undefined;
48
71
  rc: RoughCanvas;
49
72
  unmounted: boolean;
50
73
  actionManager: ActionManager;
51
- device: Device;
74
+ editorInterface: EditorInterface;
75
+ private stylesPanelMode;
52
76
  private excalidrawContainerRef;
53
77
  scene: Scene;
54
78
  fonts: Fonts;
55
79
  renderer: Renderer;
56
80
  visibleElements: readonly NonDeletedExcalidrawElement[];
57
81
  private resizeObserver;
58
- private nearestScrollableContainer;
59
82
  library: AppClassProperties["library"];
60
83
  libraryItemsFromStorage: LibraryItems | undefined;
61
84
  id: string;
@@ -79,16 +102,30 @@ declare class App extends React.Component<AppProps, AppState> {
79
102
  * insert to DOM before user initially scrolls to them) */
80
103
  private initializedEmbeds;
81
104
  private elementsPendingErasure;
105
+ private _initialized;
106
+ private readonly editorLifecycleEvents;
107
+ onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
108
+ private appStateObserver;
109
+ onStateChange: OnStateChange;
82
110
  flowChartCreator: FlowChartCreator;
83
111
  private flowChartNavigator;
112
+ bindModeHandler: ReturnType<typeof setTimeout> | null;
84
113
  hitLinkElement?: NonDeletedExcalidrawElement;
85
114
  lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
86
115
  lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
116
+ lastPointerUpIsDoubleClick: boolean;
87
117
  lastPointerMoveEvent: PointerEvent | null;
118
+ /** current frame pointer cords */
88
119
  lastPointerMoveCoords: {
89
120
  x: number;
90
121
  y: number;
91
122
  } | null;
123
+ private lastCompletedCanvasClicks;
124
+ /** previous frame pointer coords */
125
+ previousPointerMoveCoords: {
126
+ x: number;
127
+ y: number;
128
+ } | null;
92
129
  lastViewportPosition: {
93
130
  x: number;
94
131
  y: number;
@@ -111,11 +148,7 @@ declare class App extends React.Component<AppProps, AppState> {
111
148
  x: number;
112
149
  y: number;
113
150
  }>;
114
- scrollbars: {
115
- isOverEither: boolean;
116
- isOverHorizontal: boolean;
117
- isOverVertical: boolean;
118
- };
151
+ scrollbars: ReturnType<typeof isOverScrollBars>;
119
152
  lastCoords: {
120
153
  x: number;
121
154
  y: number;
@@ -128,7 +161,7 @@ declare class App extends React.Component<AppProps, AppState> {
128
161
  x: number;
129
162
  y: number;
130
163
  };
131
- arrowDirection: "end" | "origin";
164
+ arrowDirection: "origin" | "end";
132
165
  center: {
133
166
  x: number;
134
167
  y: number;
@@ -152,16 +185,13 @@ declare class App extends React.Component<AppProps, AppState> {
152
185
  x: number;
153
186
  y: number;
154
187
  };
188
+ blockDragging: boolean;
155
189
  };
156
190
  eventListeners: {
157
- onMove: {
158
- (...args: any[]): void;
159
- flush(): void;
160
- cancel(): void;
161
- } | null;
162
- onUp: ((event: PointerEvent) => void) | null;
163
- onKeyDown: ((event: KeyboardEvent) => void) | null;
164
- onKeyUp: ((event: KeyboardEvent) => void) | null;
191
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
192
+ onUp: null | ((event: PointerEvent) => void);
193
+ onKeyDown: null | ((event: KeyboardEvent) => void);
194
+ onKeyUp: null | ((event: KeyboardEvent) => void);
165
195
  };
166
196
  boxSelection: {
167
197
  hasOccurred: boolean;
@@ -180,11 +210,7 @@ declare class App extends React.Component<AppProps, AppState> {
180
210
  x: number;
181
211
  y: number;
182
212
  }>;
183
- scrollbars: {
184
- isOverEither: boolean;
185
- isOverHorizontal: boolean;
186
- isOverVertical: boolean;
187
- };
213
+ scrollbars: ReturnType<typeof isOverScrollBars>;
188
214
  lastCoords: {
189
215
  x: number;
190
216
  y: number;
@@ -197,7 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
197
223
  x: number;
198
224
  y: number;
199
225
  };
200
- arrowDirection: "end" | "origin";
226
+ arrowDirection: "origin" | "end";
201
227
  center: {
202
228
  x: number;
203
229
  y: number;
@@ -221,16 +247,13 @@ declare class App extends React.Component<AppProps, AppState> {
221
247
  x: number;
222
248
  y: number;
223
249
  };
250
+ blockDragging: boolean;
224
251
  };
225
252
  eventListeners: {
226
- onMove: {
227
- (...args: any[]): void;
228
- flush(): void;
229
- cancel(): void;
230
- } | null;
231
- onUp: ((event: PointerEvent) => void) | null;
232
- onKeyDown: ((event: KeyboardEvent) => void) | null;
233
- onKeyUp: ((event: KeyboardEvent) => void) | null;
253
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
254
+ onUp: null | ((event: PointerEvent) => void);
255
+ onKeyDown: null | ((event: KeyboardEvent) => void);
256
+ onKeyUp: null | ((event: KeyboardEvent) => void);
234
257
  };
235
258
  boxSelection: {
236
259
  hasOccurred: boolean;
@@ -242,17 +265,27 @@ declare class App extends React.Component<AppProps, AppState> {
242
265
  }>]>;
243
266
  missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
244
267
  onRemoveEventListenersEmitter: Emitter<[]>;
268
+ api: ExcalidrawImperativeAPI;
269
+ private createExcalidrawAPI;
245
270
  constructor(props: AppProps);
246
271
  updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
247
272
  private onWindowMessage;
273
+ private handleSkipBindMode;
274
+ private resetDelayedBindMode;
275
+ private previousHoveredBindableElement;
276
+ private handleDelayedBindModeChange;
248
277
  private cacheEmbeddableRef;
249
278
  /**
250
279
  * Returns gridSize taking into account `gridModeEnabled`.
251
280
  * If disabled, returns null.
252
281
  */
253
282
  getEffectiveGridSize: () => NullableGridSize;
283
+ private getTextCreationGridPoint;
254
284
  private getHTMLIFrameElement;
255
- private handleEmbeddableCenterClick;
285
+ private handleIframeLikeElementHover;
286
+ /** @returns true if iframe-like element click handled */
287
+ private handleIframeLikeCenterClick;
288
+ private isDoubleClick;
256
289
  private isIframeLikeElementCenter;
257
290
  private updateEmbedValidationStatus;
258
291
  private updateEmbeddables;
@@ -265,7 +298,7 @@ declare class App extends React.Component<AppProps, AppState> {
265
298
  render(): import("react/jsx-runtime").JSX.Element;
266
299
  focusContainer: AppClassProperties["focusContainer"];
267
300
  getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
268
- getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
301
+ getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
269
302
  getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
270
303
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
271
304
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
@@ -296,9 +329,11 @@ declare class App extends React.Component<AppProps, AppState> {
296
329
  */
297
330
  private resetScene;
298
331
  private initializeScene;
299
- private isMobileBreakpoint;
300
- private refreshViewportBreakpoints;
301
- private refreshEditorBreakpoints;
332
+ private getFormFactor;
333
+ refreshEditorInterface: () => void;
334
+ private reconcileStylesPanelMode;
335
+ /** TO BE USED LATER */
336
+ private setDesktopUIMode;
302
337
  private clearImageShapeCache;
303
338
  componentDidMount(): Promise<void>;
304
339
  componentWillUnmount(): void;
@@ -315,6 +350,7 @@ declare class App extends React.Component<AppProps, AppState> {
315
350
  private static resetTapTwice;
316
351
  private onTouchStart;
317
352
  private onTouchEnd;
353
+ private insertClipboardContent;
318
354
  pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
319
355
  addElementsFromPasteOrLibrary: (opts: {
320
356
  elements: readonly ExcalidrawElement[];
@@ -331,20 +367,27 @@ declare class App extends React.Component<AppProps, AppState> {
331
367
  setAppState: React.Component<any, AppState>["setState"];
332
368
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
333
369
  toggleLock: (source?: "keyboard" | "ui") => void;
334
- updateFrameRendering: (opts: Partial<{
335
- enabled: boolean;
336
- name: boolean;
337
- outline: boolean;
338
- clip: boolean;
339
- }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
370
+ updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
340
371
  togglePenMode: (force: boolean | null) => void;
341
372
  onHandToolToggle: () => void;
342
373
  /**
343
374
  * Zooms on canvas viewport center
344
375
  */
345
- zoomCanvas: (value: number) => void;
376
+ zoomCanvas: (
377
+ /**
378
+ * Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
379
+ * 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
380
+ */
381
+ value: number) => void;
346
382
  private cancelInProgressAnimation;
347
- scrollToContent: (target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
383
+ scrollToContent: (
384
+ /**
385
+ * target to scroll to
386
+ *
387
+ * - string - id of element or group, or url containing elementLink
388
+ * - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
389
+ */
390
+ target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
348
391
  fitToContent?: boolean;
349
392
  fitToViewport?: never;
350
393
  viewportZoomFactor?: number;
@@ -367,11 +410,7 @@ declare class App extends React.Component<AppProps, AppState> {
367
410
  private maybeUnfollowRemoteUser;
368
411
  /** use when changing scrollX/scrollY/zoom based on user interaction */
369
412
  private translateCanvas;
370
- setToast: (toast: {
371
- message: string;
372
- closable?: boolean;
373
- duration?: number;
374
- } | null) => void;
413
+ setToast: (toast: AppState["toast"]) => void;
375
414
  restoreFileFromShare: () => Promise<void>;
376
415
  /**
377
416
  * adds supplied files to existing files in the appState.
@@ -381,7 +420,7 @@ declare class App extends React.Component<AppProps, AppState> {
381
420
  private addMissingFiles;
382
421
  updateScene: <K extends keyof AppState>(sceneData: {
383
422
  elements?: SceneData["elements"];
384
- appState?: Pick<AppState, K> | null | undefined;
423
+ appState?: Pick<AppState, K> | null;
385
424
  collaborators?: SceneData["collaborators"];
386
425
  /**
387
426
  * Controls which updates should be captured by the `Store`. Captured updates are emmitted and listened to by other components, such as `History` for undo / redo purposes.
@@ -396,6 +435,7 @@ declare class App extends React.Component<AppProps, AppState> {
396
435
  */
397
436
  captureUpdate?: SceneData["captureUpdate"];
398
437
  }) => void;
438
+ applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
399
439
  mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
400
440
  private triggerRender;
401
441
  /**
@@ -403,8 +443,8 @@ declare class App extends React.Component<AppProps, AppState> {
403
443
  */
404
444
  toggleSidebar: ({ name, tab, force, }: {
405
445
  name: SidebarName | null;
406
- tab?: string | undefined;
407
- force?: boolean | undefined;
446
+ tab?: SidebarTabName;
447
+ force?: boolean;
408
448
  }) => boolean;
409
449
  private updateCurrentCursorPosition;
410
450
  getEditorUIOffsets: () => Offsets;
@@ -436,7 +476,11 @@ declare class App extends React.Component<AppProps, AppState> {
436
476
  private onGestureEnd;
437
477
  private handleTextWysiwyg;
438
478
  private deselectElements;
479
+ private getSelectedTextElement;
480
+ private getSelectedTextEditingContainerAtPosition;
439
481
  private getTextElementAtPosition;
482
+ private isHittingTextAutoResizeHandle;
483
+ private handleTextAutoResizeHandlePointerDown;
440
484
  private getElementAtPosition;
441
485
  private getElementsAtPosition;
442
486
  getElementHitThreshold(element: ExcalidrawElement): number;
@@ -445,9 +489,11 @@ declare class App extends React.Component<AppProps, AppState> {
445
489
  private startTextEditing;
446
490
  private startImageCropping;
447
491
  private finishImageCropping;
492
+ private shouldHandleBrowserCanvasDoubleClick;
448
493
  private handleCanvasDoubleClick;
494
+ private handleCanvasClick;
449
495
  private getElementLinkAtPosition;
450
- private redirectToLink;
496
+ private handleElementLinkClick;
451
497
  private getTopLayerFrameAtSceneCoords;
452
498
  private handleCanvasPointerMove;
453
499
  private handleEraser;
@@ -487,7 +533,7 @@ declare class App extends React.Component<AppProps, AppState> {
487
533
  sceneY: number;
488
534
  link: string;
489
535
  }) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
490
- private createImageElement;
536
+ private newImagePlaceholder;
491
537
  private handleLinearElementOnPointerDown;
492
538
  private getCurrentItemRoundness;
493
539
  private createGenericElementOnPointerDown;
@@ -508,11 +554,7 @@ declare class App extends React.Component<AppProps, AppState> {
508
554
  * and when you don't want to loose those modifications
509
555
  */
510
556
  private getLatestInitializedImageElement;
511
- /**
512
- * inserts image into elements array and rerenders
513
- */
514
- private insertImageElement;
515
- private onImageAction;
557
+ private onImageToolbarButtonClick;
516
558
  private getImageNaturalDimensions;
517
559
  /** updates image cache, refreshing updated elements and/or setting status
518
560
  to error for images that fail during <img> element creation */
@@ -522,12 +564,11 @@ declare class App extends React.Component<AppProps, AppState> {
522
564
  /** generally you should use `addNewImagesToImageCache()` directly if you need
523
565
  * to render new images. This is just a failsafe */
524
566
  private scheduleImageRefresh;
525
- private updateBindingEnabledOnPointerMove;
526
- private maybeSuggestBindingAtCursor;
527
567
  private clearSelection;
528
568
  private handleInteractiveCanvasRef;
569
+ private insertImages;
529
570
  private handleAppOnDrop;
530
- loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
571
+ loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
531
572
  private handleCanvasContextMenu;
532
573
  private maybeDragNewGenericElement;
533
574
  private maybeHandleCrop;
@@ -540,6 +581,7 @@ declare class App extends React.Component<AppProps, AppState> {
540
581
  private updateDOMRect;
541
582
  refresh: () => void;
542
583
  private getCanvasOffsets;
584
+ watchState: () => void;
543
585
  private updateLanguage;
544
586
  }
545
587
  declare global {
@@ -549,6 +591,7 @@ declare global {
549
591
  elements: readonly ExcalidrawElement[];
550
592
  state: AppState;
551
593
  setState: React.Component<any, AppState>["setState"];
594
+ watchState: (prev: any, next: any) => void | undefined;
552
595
  app: InstanceType<typeof App>;
553
596
  history: History;
554
597
  store: Store;
@@ -0,0 +1,37 @@
1
+ import type { AppState, UnsubscribeCallback } from "../types";
2
+ type StateChangeSelector = keyof AppState | (keyof AppState)[] | ((appState: AppState) => unknown);
3
+ export type OnStateChange = {
4
+ <K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void, opts?: {
5
+ once: boolean;
6
+ }): UnsubscribeCallback;
7
+ <K extends keyof AppState>(prop: K): Promise<AppState[K]>;
8
+ (prop: (keyof AppState)[], callback: (appState: AppState, appState2: AppState) => void, opts?: {
9
+ once: boolean;
10
+ }): UnsubscribeCallback;
11
+ (prop: (keyof AppState)[]): Promise<AppState>;
12
+ <T>(prop: (appState: AppState) => T, callback: (value: T, appState: AppState) => void, opts?: {
13
+ once: boolean;
14
+ }): UnsubscribeCallback;
15
+ <T>(prop: (appState: AppState) => T): Promise<T>;
16
+ (opts: {
17
+ predicate: (appState: AppState) => boolean;
18
+ callback: (appState: AppState) => void;
19
+ once?: boolean;
20
+ }): UnsubscribeCallback;
21
+ (opts: {
22
+ predicate: (appState: AppState) => boolean;
23
+ }): Promise<AppState>;
24
+ (selector: StateChangeSelector, callback: (value: any, appState: AppState) => void): any;
25
+ };
26
+ export declare class AppStateObserver {
27
+ private readonly getState;
28
+ private listeners;
29
+ constructor(getState: () => AppState);
30
+ private isStateChangePredicateOptions;
31
+ private subscribe;
32
+ private normalize;
33
+ onStateChange: OnStateChange;
34
+ flush(prevState: AppState): void;
35
+ clear(): void;
36
+ }
37
+ export {};
@@ -1,7 +1,5 @@
1
- /// <reference types="react" />
2
- import OpenColor from "open-color";
3
1
  import "./Card.scss";
4
2
  export declare const Card: React.FC<{
5
- color: keyof OpenColor | "primary";
3
+ color: "primary" | "lime" | "pink";
6
4
  children?: React.ReactNode;
7
5
  }>;
@@ -1,10 +1,8 @@
1
1
  import type { ColorPickerType } from "./colorPickerUtils";
2
- interface ColorInputProps {
2
+ export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: {
3
3
  color: string;
4
4
  onChange: (color: string) => void;
5
5
  label: string;
6
6
  colorPickerType: ColorPickerType;
7
7
  placeholder?: string;
8
- }
9
- export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
10
- export {};
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,6 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
3
3
  import "./ColorPicker.scss";
4
4
  import type { ColorPickerType } from "./colorPickerUtils";
5
5
  import type { AppState } from "../../types";
6
- export declare const getColor: (color: string) => string | null;
7
6
  interface ColorPickerProps {
8
7
  type: ColorPickerType;
9
8
  /**