@excalidraw/excalidraw 0.18.0-817d8c5 → 0.18.0-880dbb25e

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 (298) hide show
  1. package/CHANGELOG.md +11 -11
  2. package/dist/dev/chunk-CP5DND7P.js +7 -0
  3. package/dist/dev/chunk-CP5DND7P.js.map +7 -0
  4. package/dist/dev/chunk-CRKRRBMD.js +5677 -0
  5. package/dist/dev/chunk-CRKRRBMD.js.map +7 -0
  6. package/dist/dev/chunk-FB2NA5UG.js +4132 -0
  7. package/dist/dev/chunk-FB2NA5UG.js.map +7 -0
  8. package/dist/dev/{chunk-LMHBUWQS.js → chunk-QF5FRM6O.js} +16 -5
  9. package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
  10. package/dist/dev/data/{image-V26YBSDB.js → image-IWGLHPIX.js} +3 -3
  11. package/dist/dev/index.css +3021 -2942
  12. package/dist/dev/index.css.map +3 -3
  13. package/dist/dev/index.js +30933 -24345
  14. package/dist/dev/index.js.map +4 -4
  15. package/dist/dev/locales/{en-OZCJJ2HN.js → en-SMAPCEOQ.js} +2 -2
  16. package/dist/dev/subset-shared.chunk.js +2 -2
  17. package/dist/dev/subset-worker.chunk.js +2 -2
  18. package/dist/prod/chunk-A66AFZZU.js +7 -0
  19. package/dist/prod/chunk-HHV2PJKY.js +4 -0
  20. package/dist/prod/chunk-I4UNSFV6.js +12 -0
  21. package/dist/prod/chunk-LS7FJGPW.js +86 -0
  22. package/dist/prod/data/image-4SM4COIL.js +1 -0
  23. package/dist/prod/index.css +1 -1
  24. package/dist/prod/index.js +27 -16
  25. package/dist/prod/locales/{en-B4ZKOASM.js → en-TYY6KWIJ.js} +1 -1
  26. package/dist/prod/subset-shared.chunk.js +1 -1
  27. package/dist/prod/subset-worker.chunk.js +1 -1
  28. package/dist/types/{excalidraw/binaryheap.d.ts → common/src/binary-heap.d.ts} +1 -1
  29. package/dist/types/{excalidraw → common/src}/colors.d.ts +1 -0
  30. package/dist/types/{excalidraw → common/src}/constants.d.ts +29 -8
  31. package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  32. package/dist/types/{excalidraw/fonts/FontMetadata.d.ts → common/src/font-metadata.d.ts} +15 -5
  33. package/dist/types/common/src/index.d.ts +12 -0
  34. package/dist/types/{excalidraw → common/src}/points.d.ts +2 -0
  35. package/dist/types/common/src/promise-pool.d.ts +6 -0
  36. package/dist/types/{excalidraw → common/src}/utility-types.d.ts +5 -0
  37. package/dist/types/{excalidraw → common/src}/utils.d.ts +22 -11
  38. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +19 -18
  39. package/dist/types/element/src/align.d.ts +8 -0
  40. package/dist/types/{excalidraw/element → element/src}/binding.d.ts +30 -19
  41. package/dist/types/{excalidraw/element → element/src}/bounds.d.ts +19 -6
  42. package/dist/types/element/src/collision.d.ts +32 -0
  43. package/dist/types/{excalidraw/scene → element/src}/comparisons.d.ts +1 -1
  44. package/dist/types/{excalidraw/element → element/src}/cropElement.d.ts +1 -1
  45. package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +80 -42
  46. package/dist/types/element/src/distance.d.ts +3 -0
  47. package/dist/types/{excalidraw → element/src}/distribute.d.ts +3 -2
  48. package/dist/types/{excalidraw/element → element/src}/dragElements.d.ts +5 -4
  49. package/dist/types/element/src/duplicate.d.ts +63 -0
  50. package/dist/types/{excalidraw/element → element/src}/elbowArrow.d.ts +1 -1
  51. package/dist/types/{excalidraw/element → element/src}/elementLink.d.ts +1 -1
  52. package/dist/types/element/src/embeddable.d.ts +10 -0
  53. package/dist/types/{excalidraw/element → element/src}/flowchart.d.ts +4 -3
  54. package/dist/types/{excalidraw → element/src}/fractionalIndex.d.ts +12 -3
  55. package/dist/types/{excalidraw → element/src}/frame.d.ts +8 -7
  56. package/dist/types/{excalidraw → element/src}/groups.d.ts +6 -5
  57. package/dist/types/{excalidraw/element → element/src}/heading.d.ts +1 -2
  58. package/dist/types/{excalidraw/element → element/src}/image.d.ts +2 -2
  59. package/dist/types/element/src/index.d.ts +57 -0
  60. package/dist/types/{excalidraw/element → element/src}/linearElementEditor.d.ts +24 -37
  61. package/dist/types/element/src/mutateElement.d.ts +21 -0
  62. package/dist/types/{excalidraw/element → element/src}/newElement.d.ts +4 -43
  63. package/dist/types/{excalidraw/renderer → element/src}/renderElement.d.ts +3 -3
  64. package/dist/types/{excalidraw/element → element/src}/resizeElements.d.ts +7 -6
  65. package/dist/types/{excalidraw/element → element/src}/resizeTest.d.ts +4 -4
  66. package/dist/types/{excalidraw/scene → element/src}/selection.d.ts +13 -7
  67. package/dist/types/element/src/shape.d.ts +42 -0
  68. package/dist/types/{excalidraw/element → element/src}/showSelectedShapeActions.d.ts +1 -1
  69. package/dist/types/{excalidraw/element → element/src}/sizeHelpers.d.ts +3 -3
  70. package/dist/types/element/src/store.d.ts +236 -0
  71. package/dist/types/{excalidraw/element → element/src}/textElement.d.ts +8 -7
  72. package/dist/types/{excalidraw/element → element/src}/transformHandles.d.ts +7 -7
  73. package/dist/types/{excalidraw/element → element/src}/typeChecks.d.ts +21 -3
  74. package/dist/types/{excalidraw/element → element/src}/types.d.ts +17 -4
  75. package/dist/types/element/src/utils.d.ts +31 -0
  76. package/dist/types/{excalidraw → element/src}/zindex.d.ts +5 -4
  77. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +97 -106
  78. package/dist/types/excalidraw/actions/actionAlign.d.ts +7 -7
  79. package/dist/types/excalidraw/actions/actionBoundText.d.ts +70 -76
  80. package/dist/types/excalidraw/actions/actionCanvas.d.ts +627 -490
  81. package/dist/types/excalidraw/actions/actionClipboard.d.ts +206 -222
  82. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +34 -37
  83. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +102 -110
  84. package/dist/types/excalidraw/actions/actionDistribute.d.ts +3 -3
  85. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -7
  86. package/dist/types/excalidraw/actions/actionElementLink.d.ts +37 -40
  87. package/dist/types/excalidraw/actions/actionElementLock.d.ts +82 -90
  88. package/dist/types/excalidraw/{element/embeddable.d.ts → actions/actionEmbeddable.d.ts} +34 -47
  89. package/dist/types/excalidraw/actions/actionExport.d.ts +351 -378
  90. package/dist/types/excalidraw/actions/actionFinalize.d.ts +100 -65
  91. package/dist/types/excalidraw/actions/actionFlip.d.ts +3 -3
  92. package/dist/types/excalidraw/actions/actionFrame.d.ts +252 -264
  93. package/dist/types/excalidraw/actions/actionGroup.d.ts +67 -73
  94. package/dist/types/excalidraw/actions/actionHistory.d.ts +2 -3
  95. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +561 -40
  96. package/dist/types/excalidraw/actions/actionLink.d.ts +35 -38
  97. package/dist/types/excalidraw/actions/actionMenu.d.ts +98 -107
  98. package/dist/types/excalidraw/actions/actionNavigate.d.ts +65 -71
  99. package/dist/types/excalidraw/actions/actionProperties.d.ts +469 -506
  100. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +35 -38
  101. package/dist/types/excalidraw/actions/actionStyles.d.ts +36 -39
  102. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  103. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +34 -37
  104. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +34 -37
  105. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +33 -208
  106. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  107. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +33 -37
  108. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +34 -38
  109. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +34 -38
  110. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  111. package/dist/types/excalidraw/actions/index.d.ts +1 -0
  112. package/dist/types/excalidraw/actions/manager.d.ts +2 -2
  113. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  114. package/dist/types/excalidraw/actions/types.d.ts +6 -5
  115. package/dist/types/excalidraw/animated-trail.d.ts +7 -1
  116. package/dist/types/excalidraw/appState.d.ts +38 -28
  117. package/dist/types/excalidraw/charts.d.ts +1 -1
  118. package/dist/types/excalidraw/clipboard.d.ts +7 -7
  119. package/dist/types/excalidraw/components/Actions.d.ts +3 -7
  120. package/dist/types/excalidraw/components/App.d.ts +46 -29
  121. package/dist/types/excalidraw/components/Avatar.d.ts +1 -1
  122. package/dist/types/excalidraw/components/ButtonIcon.d.ts +2 -1
  123. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  124. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -5
  125. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  126. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +1 -2
  127. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -5
  128. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -4
  129. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -3
  130. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  131. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +4 -4
  132. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  133. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -1
  134. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +1 -1
  135. package/dist/types/excalidraw/components/ContextMenu.d.ts +2 -2
  136. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  137. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  138. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +2 -2
  139. package/dist/types/excalidraw/components/DialogActionButton.d.ts +1 -1
  140. package/dist/types/excalidraw/{element → components}/ElementCanvasButtons.d.ts +1 -1
  141. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +5 -4
  142. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  143. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  144. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +1 -1
  145. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +1 -1
  146. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +1 -1
  147. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +3 -3
  148. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +1 -1
  149. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +1 -1
  150. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  151. package/dist/types/excalidraw/components/IconPicker.d.ts +1 -1
  152. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +2 -2
  153. package/dist/types/excalidraw/components/InitializeApp.d.ts +1 -1
  154. package/dist/types/excalidraw/components/Island.d.ts +1 -1
  155. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +2 -2
  156. package/dist/types/excalidraw/components/LayerUI.d.ts +3 -3
  157. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -1
  158. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +1 -1
  159. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +3 -3
  160. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -2
  161. package/dist/types/excalidraw/components/LoadingMessage.d.ts +1 -1
  162. package/dist/types/excalidraw/components/MagicButton.d.ts +1 -1
  163. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -3
  164. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +1 -1
  165. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  166. package/dist/types/excalidraw/components/PublishLibrary.d.ts +1 -1
  167. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  168. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  169. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  170. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -1
  171. package/dist/types/excalidraw/components/Sidebar/common.d.ts +1 -1
  172. package/dist/types/excalidraw/components/Stack.d.ts +1 -1
  173. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  174. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  175. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  176. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  177. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +14 -4
  178. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +2 -2
  179. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  180. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +3 -3
  181. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +2 -2
  182. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  183. package/dist/types/excalidraw/components/Stats/Position.d.ts +2 -2
  184. package/dist/types/excalidraw/components/Stats/index.d.ts +2 -2
  185. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  186. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
  187. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +1 -1
  188. package/dist/types/excalidraw/components/TextField.d.ts +1 -1
  189. package/dist/types/excalidraw/components/Toast.d.ts +1 -1
  190. package/dist/types/excalidraw/components/ToolButton.d.ts +2 -2
  191. package/dist/types/excalidraw/components/Tooltip.d.ts +1 -1
  192. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  193. package/dist/types/excalidraw/components/UserList.d.ts +1 -1
  194. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -3
  195. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -2
  196. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +3 -3
  197. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +1 -1
  198. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +2 -2
  199. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +1 -1
  200. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +5 -4
  201. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -2
  202. package/dist/types/excalidraw/components/icons.d.ts +5 -1
  203. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  204. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +4 -1
  205. package/dist/types/excalidraw/components/shapes.d.ts +62 -0
  206. package/dist/types/excalidraw/context/tunnels.d.ts +1 -1
  207. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +1 -1
  208. package/dist/types/excalidraw/data/blob.d.ts +4 -4
  209. package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
  210. package/dist/types/excalidraw/data/index.d.ts +2 -2
  211. package/dist/types/excalidraw/data/json.d.ts +1 -1
  212. package/dist/types/excalidraw/data/library.d.ts +3 -3
  213. package/dist/types/excalidraw/data/reconcile.d.ts +3 -2
  214. package/dist/types/excalidraw/data/resave.d.ts +1 -1
  215. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  216. package/dist/types/excalidraw/data/transform.d.ts +4 -4
  217. package/dist/types/excalidraw/data/types.d.ts +3 -3
  218. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  219. package/dist/types/excalidraw/eraser/index.d.ts +12 -0
  220. package/dist/types/excalidraw/errors.d.ts +0 -3
  221. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -13
  222. package/dist/types/excalidraw/history.d.ts +31 -23
  223. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  224. package/dist/types/excalidraw/i18n.d.ts +1 -1
  225. package/dist/types/excalidraw/index.d.ts +18 -16
  226. package/dist/types/excalidraw/laser-trails.d.ts +1 -1
  227. package/dist/types/excalidraw/lasso/index.d.ts +16 -0
  228. package/dist/types/excalidraw/lasso/utils.d.ts +13 -0
  229. package/dist/types/excalidraw/renderer/helpers.d.ts +8 -3
  230. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  231. package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +2 -2
  232. package/dist/types/excalidraw/scene/Renderer.d.ts +3 -4
  233. package/dist/types/excalidraw/scene/export.d.ts +1 -1
  234. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  235. package/dist/types/excalidraw/scene/scroll.d.ts +1 -1
  236. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  237. package/dist/types/excalidraw/scene/types.d.ts +6 -4
  238. package/dist/types/excalidraw/snapping.d.ts +5 -6
  239. package/dist/types/excalidraw/types.d.ts +45 -25
  240. package/dist/types/excalidraw/{element → wysiwyg}/textWysiwyg.d.ts +4 -2
  241. package/dist/types/math/{angle.d.ts → src/angle.d.ts} +2 -0
  242. package/dist/types/math/src/constants.d.ts +3 -0
  243. package/dist/types/math/src/curve.d.ts +74 -0
  244. package/dist/types/math/{index.d.ts → src/index.d.ts} +1 -0
  245. package/dist/types/math/{point.d.ts → src/point.d.ts} +3 -3
  246. package/dist/types/math/{polygon.d.ts → src/polygon.d.ts} +1 -0
  247. package/dist/types/math/{rectangle.d.ts → src/rectangle.d.ts} +2 -0
  248. package/dist/types/math/{segment.d.ts → src/segment.d.ts} +1 -1
  249. package/dist/types/math/{types.d.ts → src/types.d.ts} +1 -0
  250. package/dist/types/math/{vector.d.ts → src/vector.d.ts} +8 -2
  251. package/dist/types/utils/{bbox.d.ts → src/bbox.d.ts} +1 -1
  252. package/dist/types/utils/{export.d.ts → src/export.d.ts} +2 -2
  253. package/dist/types/utils/{index.d.ts → src/index.d.ts} +1 -1
  254. package/dist/types/utils/{geometry → src}/shape.d.ts +2 -15
  255. package/dist/types/utils/{withinBounds.d.ts → src/withinBounds.d.ts} +2 -2
  256. package/history.ts +148 -109
  257. package/package.json +25 -10
  258. package/dist/dev/chunk-3SN6HYVK.js +0 -25695
  259. package/dist/dev/chunk-3SN6HYVK.js.map +0 -7
  260. package/dist/dev/chunk-53KHN5WM.js +0 -7
  261. package/dist/dev/chunk-53KHN5WM.js.map +0 -7
  262. package/dist/dev/chunk-LMHBUWQS.js.map +0 -7
  263. package/dist/dev/chunk-OKSO7T74.js +0 -4132
  264. package/dist/dev/chunk-OKSO7T74.js.map +0 -7
  265. package/dist/prod/chunk-36CXSE6H.js +0 -34
  266. package/dist/prod/chunk-6U3AYISY.js +0 -12
  267. package/dist/prod/chunk-EIO257PC.js +0 -86
  268. package/dist/prod/chunk-G5N3DNGT.js +0 -7
  269. package/dist/prod/data/image-N4WCURRR.js +0 -1
  270. package/dist/types/excalidraw/align.d.ts +0 -7
  271. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  272. package/dist/types/excalidraw/element/collision.d.ts +0 -26
  273. package/dist/types/excalidraw/element/distance.d.ts +0 -3
  274. package/dist/types/excalidraw/element/index.d.ts +0 -26
  275. package/dist/types/excalidraw/element/mutateElement.d.ts +0 -13
  276. package/dist/types/excalidraw/element/utils.d.ts +0 -21
  277. package/dist/types/excalidraw/scene/Shape.d.ts +0 -17
  278. package/dist/types/excalidraw/scene/ShapeCache.d.ts +0 -25
  279. package/dist/types/excalidraw/shapes.d.ts +0 -85
  280. package/dist/types/excalidraw/store.d.ts +0 -129
  281. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  282. package/dist/types/math/curve.d.ts +0 -40
  283. package/dist/types/utils/collision.d.ts +0 -9
  284. /package/dist/dev/data/{image-V26YBSDB.js.map → image-IWGLHPIX.js.map} +0 -0
  285. /package/dist/dev/locales/{en-OZCJJ2HN.js.map → en-SMAPCEOQ.js.map} +0 -0
  286. /package/dist/types/{excalidraw → common/src}/keys.d.ts +0 -0
  287. /package/dist/types/{excalidraw → common/src}/queue.d.ts +0 -0
  288. /package/dist/types/{excalidraw → common/src}/random.d.ts +0 -0
  289. /package/dist/types/{excalidraw/data → common/src}/url.d.ts +0 -0
  290. /package/dist/types/{excalidraw/element → element/src}/containerCache.d.ts +0 -0
  291. /package/dist/types/{excalidraw/element → element/src}/sortElements.d.ts +0 -0
  292. /package/dist/types/{excalidraw/element → element/src}/textMeasurements.d.ts +0 -0
  293. /package/dist/types/{excalidraw/element → element/src}/textWrapping.d.ts +0 -0
  294. /package/dist/types/math/{ellipse.d.ts → src/ellipse.d.ts} +0 -0
  295. /package/dist/types/math/{line.d.ts → src/line.d.ts} +0 -0
  296. /package/dist/types/math/{range.d.ts → src/range.d.ts} +0 -0
  297. /package/dist/types/math/{triangle.d.ts → src/triangle.d.ts} +0 -0
  298. /package/dist/types/math/{utils.d.ts → src/utils.d.ts} +0 -0
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-6U3AYISY.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,s as clearCanvasDialog,C as colorPicker,A as colors,I as commandPalette,v as confirmDialog,J as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,G as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,F as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,H as userList,B as welcomeScreen};
1
+ import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-I4UNSFV6.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,s as clearCanvasDialog,C as colorPicker,A as colors,I as commandPalette,v as confirmDialog,J as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,G as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,F as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,H as userList,B as welcomeScreen};
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-EIO257PC.js";import"./chunk-G5N3DNGT.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-A66AFZZU.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-EIO257PC.js";import"./chunk-G5N3DNGT.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-A66AFZZU.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -1,4 +1,4 @@
1
- export default class BinaryHeap<T> {
1
+ export declare class BinaryHeap<T> {
2
2
  private scoreFunction;
3
3
  private content;
4
4
  constructor(scoreFunction: (node: T) => number);
@@ -1,5 +1,6 @@
1
1
  import oc from "open-color";
2
2
  import type { Merge } from "./utility-types";
3
+ export declare const COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
3
4
  export type ColorPickerColor = Exclude<keyof oc, "indigo" | "lime"> | "transparent" | "bronze";
4
5
  export type ColorTuple = readonly [string, string, string, string, string];
5
6
  export type ColorPalette = Merge<Record<ColorPickerColor, ColorTuple>, {
@@ -1,5 +1,5 @@
1
- import type { AppProps, AppState } from "./types";
2
- import type { ExcalidrawElement, FontFamilyValues } from "./element/types";
1
+ import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
2
+ import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
3
3
  export declare const isDarwin: boolean;
4
4
  export declare const isWindows: boolean;
5
5
  export declare const isAndroid: boolean;
@@ -12,6 +12,7 @@ export declare const supportsResizeObserver: boolean;
12
12
  export declare const APP_NAME = "Excalidraw";
13
13
  export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
14
14
  export declare const DRAGGING_THRESHOLD = 10;
15
+ export declare const MINIMUM_ARROW_SIZE = 20;
15
16
  export declare const LINE_CONFIRM_THRESHOLD = 8;
16
17
  export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
17
18
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
@@ -82,11 +83,13 @@ export declare const YOUTUBE_STATES: {
82
83
  export declare const ENV: {
83
84
  TEST: string;
84
85
  DEVELOPMENT: string;
86
+ PRODUCTION: string;
85
87
  };
86
88
  export declare const CLASSES: {
87
89
  SHAPE_ACTIONS_MENU: string;
88
90
  ZOOM_ACTIONS: string;
89
91
  SEARCH_MENU_INPUT_WRAPPER: string;
92
+ CONVERT_ELEMENT_TYPE_POPUP: string;
90
93
  };
91
94
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
92
95
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -107,11 +110,21 @@ export declare const FONT_FAMILY: {
107
110
  "Lilita One": number;
108
111
  "Comic Shanns": number;
109
112
  "Liberation Sans": number;
113
+ Assistant: number;
114
+ };
115
+ export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
116
+ export declare const MONOSPACE_GENERIC_FONT = "monospace";
117
+ export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
118
+ "sans-serif": number;
119
+ monospace: number;
110
120
  };
111
121
  export declare const FONT_FAMILY_FALLBACKS: {
112
- Xiaolai: number;
113
122
  "Segoe UI Emoji": number;
123
+ "sans-serif": number;
124
+ monospace: number;
125
+ Xiaolai: number;
114
126
  };
127
+ export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
115
128
  export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
116
129
  export declare const THEME: {
117
130
  readonly LIGHT: "light";
@@ -120,11 +133,11 @@ export declare const THEME: {
120
133
  export declare const FRAME_STYLE: {
121
134
  strokeColor: string;
122
135
  strokeWidth: number;
123
- strokeStyle: import("./element/types").StrokeStyle;
124
- fillStyle: import("./element/types").FillStyle;
136
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
137
+ fillStyle: import("@excalidraw/element/types").FillStyle;
125
138
  roughness: number;
126
139
  roundness: {
127
- type: import("./element/types").RoundnessType;
140
+ type: import("@excalidraw/element/types").RoundnessType;
128
141
  value?: number | undefined;
129
142
  } | null;
130
143
  backgroundColor: string;
@@ -193,7 +206,7 @@ export declare const EXPORT_DATA_TYPES: {
193
206
  readonly excalidrawLibrary: "excalidrawlib";
194
207
  readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
195
208
  };
196
- export declare const EXPORT_SOURCE: string;
209
+ export declare const getExportSource: () => string;
197
210
  export declare const IMAGE_RENDER_TIMEOUT = 500;
198
211
  export declare const TAP_TWICE_TIMEOUT = 300;
199
212
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -224,6 +237,7 @@ export declare const DEFAULT_EXPORT_PADDING = 10;
224
237
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
225
238
  export declare const MAX_ALLOWED_FILE_BYTES: number;
226
239
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
240
+ export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
227
241
  export declare const ENCRYPTION_KEY_BITS = 128;
228
242
  export declare const VERSIONS: {
229
243
  readonly excalidraw: 2;
@@ -276,9 +290,10 @@ export declare const DEFAULT_SIDEBAR: {
276
290
  readonly name: "default";
277
291
  readonly defaultTab: "library";
278
292
  };
279
- export declare const LIBRARY_DISABLED_TYPES: Set<"image" | "iframe" | "embeddable">;
293
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
280
294
  export declare const TOOL_TYPE: {
281
295
  readonly selection: "selection";
296
+ readonly lasso: "lasso";
282
297
  readonly rectangle: "rectangle";
283
298
  readonly diamond: "diamond";
284
299
  readonly ellipse: "ellipse";
@@ -321,3 +336,9 @@ export declare enum UserIdleState {
321
336
  AWAY = "away",
322
337
  IDLE = "idle"
323
338
  }
339
+ /**
340
+ * distance at which we merge points instead of adding a new merge-point
341
+ * when converting a line to a polygon (merge currently means overlaping
342
+ * the start and end points)
343
+ */
344
+ export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
@@ -1,4 +1,4 @@
1
- import type { UnsubscribeCallback } from "./types";
1
+ import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
2
2
  type Subscriber<T extends any[]> = (...payload: T) => void;
3
3
  export declare class Emitter<T extends any[] = []> {
4
4
  subscribers: Subscriber<T>[];
@@ -1,4 +1,4 @@
1
- import type { JSX } from "react";
1
+ import type { ExcalidrawTextElement, FontFamilyValues } from "@excalidraw/element/types";
2
2
  /**
3
3
  * Encapsulates font metrics with additional font metadata.
4
4
  * */
@@ -14,12 +14,12 @@ export interface FontMetadata {
14
14
  /** harcoded unitless line-height, https://github.com/excalidraw/excalidraw/pull/6360#issuecomment-1477635971 */
15
15
  lineHeight: number;
16
16
  };
17
- /** element to be displayed as an icon */
18
- icon?: JSX.Element;
19
17
  /** flag to indicate a deprecated font */
20
18
  deprecated?: true;
21
- /** flag to indicate a server-side only font */
22
- serverSide?: true;
19
+ /**
20
+ * whether this is a font that users can use (= shown in font picker)
21
+ */
22
+ private?: true;
23
23
  /** flag to indiccate a local-only font */
24
24
  local?: true;
25
25
  /** flag to indicate a fallback font */
@@ -36,3 +36,13 @@ export declare const GOOGLE_FONTS_RANGES: {
36
36
  };
37
37
  /** local protocol to skip the local font from registering or inlining */
38
38
  export declare const LOCAL_FONT_PROTOCOL = "local:";
39
+ /**
40
+ * Calculates vertical offset for a text with alphabetic baseline.
41
+ */
42
+ export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["fontFamily"], fontSize: ExcalidrawTextElement["fontSize"], lineHeightPx: number) => number;
43
+ /**
44
+ * Gets line height for a selected family.
45
+ */
46
+ export declare const getLineHeight: (fontFamily: FontFamilyValues) => number & {
47
+ _brand: "unitlessLineHeight";
48
+ };
@@ -0,0 +1,12 @@
1
+ export * from "./binary-heap";
2
+ export * from "./colors";
3
+ export * from "./constants";
4
+ export * from "./font-metadata";
5
+ export * from "./queue";
6
+ export * from "./keys";
7
+ export * from "./points";
8
+ export * from "./promise-pool";
9
+ export * from "./random";
10
+ export * from "./url";
11
+ export * from "./utils";
12
+ export * from "./emitter";
@@ -1,7 +1,9 @@
1
1
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
+ import type { NullableGridSize } from "@excalidraw/excalidraw/types";
2
3
  export declare const getSizeFromPoints: (points: readonly (GlobalPoint | LocalPoint)[]) => {
3
4
  width: number;
4
5
  height: number;
5
6
  };
6
7
  /** @arg dimension, 0 for rescaling only x, 1 for y */
7
8
  export declare const rescalePoints: <Point extends GlobalPoint | LocalPoint>(dimension: 0 | 1, newSize: number, points: readonly Point[], normalize: boolean) => Point[];
9
+ export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) => [number, number];
@@ -0,0 +1,6 @@
1
+ export declare class PromisePool<T> {
2
+ private readonly pool;
3
+ private readonly entries;
4
+ constructor(source: IterableIterator<Promise<void | readonly [number, T]>>, concurrency: number);
5
+ all(): PromiseLike<T[]>;
6
+ }
@@ -31,3 +31,8 @@ export type MakeBrand<T extends string> = {
31
31
  /** Maybe just promise or already fulfilled one! */
32
32
  export type MaybePromise<T> = T | Promise<T>;
33
33
  export type AllPossibleKeys<T> = T extends any ? keyof T : never;
34
+ /** Strip all the methods or functions from a type */
35
+ export type DTO<T> = {
36
+ [K in keyof T as T[K] extends Function ? never : K]: T[K];
37
+ };
38
+ export type MapEntry<M extends Map<any, any>> = M extends Map<infer K, infer V> ? [K, V] : never;
@@ -1,14 +1,14 @@
1
- import type { EVENT } from "./constants";
2
- import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "./element/types";
3
- import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "./types";
1
+ import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
2
+ import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
4
3
  import type { MaybePromise } from "./utility-types";
4
+ import type { EVENT } from "./constants";
5
5
  export declare const setDateTimeForTests: (dateTime: string) => void;
6
6
  export declare const getDateTime: () => string;
7
7
  export declare const capitalizeString: (str: string) => string;
8
8
  export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
9
- export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement;
9
+ export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
10
10
  export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
11
- export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement;
11
+ export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLTextAreaElement;
12
12
  export declare const getFontFamilyString: ({ fontFamily, }: {
13
13
  fontFamily: FontFamilyValues;
14
14
  }) => string;
@@ -87,6 +87,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
87
87
  customType: string;
88
88
  }) & {
89
89
  locked?: boolean;
90
+ fromSelection?: boolean;
90
91
  }) & {
91
92
  lastActiveToolBeforeEraser?: ActiveTool | null;
92
93
  }) => AppState["activeTool"];
@@ -136,6 +137,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
136
137
  export declare const muteFSAbortError: (error?: Error) => void;
137
138
  export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
138
139
  export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
140
+ /** returns the first non-null mapped value */
141
+ export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
139
142
  export declare const isTransparent: (color: string) => boolean;
140
143
  export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
141
144
  export type ResolvablePromise<T> = Promise<T> & {
@@ -176,8 +179,18 @@ export type Node<T> = T & {
176
179
  * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
177
180
  */
178
181
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
182
+ /**
183
+ * Converts a readonly array or map into an iterable.
184
+ * Useful for avoiding entry allocations when iterating object / map on each iteration.
185
+ */
186
+ export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
187
+ /**
188
+ * Converts a readonly array or map into an array.
189
+ */
190
+ export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
179
191
  export declare const isTestEnv: () => boolean;
180
192
  export declare const isDevEnv: () => boolean;
193
+ export declare const isProdEnv: () => boolean;
181
194
  export declare const isServerEnv: () => boolean;
182
195
  export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
183
196
  nativeEvent: T;
@@ -241,16 +254,14 @@ export declare const toBrandedType: <BrandedType, CurrentType = BrandedType>(val
241
254
  export declare const promiseTry: <TValue, TArgs extends unknown[]>(fn: (...args: TArgs) => TValue | PromiseLike<TValue>, ...args: TArgs) => Promise<TValue>;
242
255
  export declare const isAnyTrue: (...args: boolean[]) => boolean;
243
256
  export declare const safelyParseJSON: (json: string) => Record<string, any> | null;
244
- export declare class PromisePool<T> {
245
- private readonly pool;
246
- private readonly entries;
247
- constructor(source: IterableIterator<Promise<void | readonly [number, T]>>, concurrency: number);
248
- all(): PromiseLike<T[]>;
249
- }
250
257
  /**
251
258
  * use when you need to render unsafe string as HTML attribute, but MAKE SURE
252
259
  * the attribute is double-quoted when constructing the HTML string
253
260
  */
254
261
  export declare const escapeDoubleQuotes: (str: string) => string;
255
262
  export declare const castArray: <T>(value: T | T[]) => T[];
263
+ /** hack for Array.isArray type guard not working with readonly value[] */
264
+ export declare const isReadonlyArray: (value?: any) => value is readonly any[];
265
+ export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
266
+ export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
256
267
  export {};
@@ -1,19 +1,11 @@
1
- import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "../element/types";
2
- import type { LinearElementEditor } from "../element/linearElementEditor";
3
- import type { AppState } from "../types";
4
- type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
5
- type ElementKey = ExcalidrawElement | ElementIdKey;
1
+ import { type ElementUpdate } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "@excalidraw/element/types";
3
+ import type { Mutable } from "@excalidraw/common/utility-types";
4
+ import type { AppState } from "../../excalidraw/types";
6
5
  type SceneStateCallback = () => void;
7
6
  type SceneStateCallbackRemover = () => void;
8
7
  export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
9
- declare class Scene {
10
- private static sceneMapByElement;
11
- private static sceneMapById;
12
- static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
13
- /**
14
- * @deprecated pass down `app.scene` and use it directly
15
- */
16
- static getScene(elementKey: ElementKey): Scene | null;
8
+ export declare class Scene {
17
9
  private callbacks;
18
10
  private nonDeletedElements;
19
11
  private nonDeletedElementsMap;
@@ -30,11 +22,14 @@ declare class Scene {
30
22
  */
31
23
  private sceneNonce;
32
24
  getSceneNonce(): number | undefined;
33
- getNonDeletedElementsMap(): Map<string, Ordered<NonDeletedExcalidrawElement>> & import("../utility-types").MakeBrand<"NonDeletedSceneElementsMap">;
25
+ getNonDeletedElementsMap(): Map<string, Ordered<NonDeletedExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedSceneElementsMap">;
34
26
  getElementsIncludingDeleted(): readonly OrderedExcalidrawElement[];
35
- getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("../utility-types").MakeBrand<"SceneElementsMap">;
27
+ getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
36
28
  getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
37
29
  getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
30
+ constructor(elements?: ElementsMapOrArray | null, options?: {
31
+ skipValidation?: true;
32
+ });
38
33
  getSelectedElements(opts: {
39
34
  selectedElementIds: AppState["selectedElementIds"];
40
35
  /**
@@ -62,7 +57,9 @@ declare class Scene {
62
57
  * @returns whether a change was made
63
58
  */
64
59
  mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
65
- replaceAllElements(nextElements: ElementsMapOrArray): void;
60
+ replaceAllElements(nextElements: ElementsMapOrArray, options?: {
61
+ skipValidation?: true;
62
+ }): void;
66
63
  triggerUpdate(): void;
67
64
  onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
68
65
  destroy(): void;
@@ -73,7 +70,11 @@ declare class Scene {
73
70
  getElementIndex(elementId: string): number;
74
71
  getContainerElement: (element: (ExcalidrawElement & {
75
72
  containerId: ExcalidrawElement["id"] | null;
76
- }) | null) => import("../element/types").ExcalidrawSelectionElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawFreeDrawElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawEmbeddableElement | null;
73
+ }) | null) => import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
77
74
  getElementsFromId: (id: string) => ExcalidrawElement[];
75
+ mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
76
+ informMutation: boolean;
77
+ isDragging: boolean;
78
+ }): TElement;
78
79
  }
79
- export default Scene;
80
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { AppState } from "@excalidraw/excalidraw/types";
2
+ import type { Scene } from "./Scene";
3
+ import type { ExcalidrawElement } from "./types";
4
+ export interface Alignment {
5
+ position: "start" | "center" | "end";
6
+ axis: "x" | "y";
7
+ }
8
+ export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => ExcalidrawElement[];
@@ -1,11 +1,11 @@
1
- import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, OrderedExcalidrawElement, ExcalidrawElbowArrowElement, FixedPoint, SceneElementsMap } from "./types";
1
+ import { type GlobalPoint } from "@excalidraw/math";
2
+ import type { LocalPoint } from "@excalidraw/math";
3
+ import type { AppState } from "@excalidraw/excalidraw/types";
4
+ import { type Heading } from "./heading";
5
+ import type { Scene } from "./Scene";
2
6
  import type { Bounds } from "./bounds";
3
- import type { AppState } from "../types";
4
7
  import type { ElementUpdate } from "./mutateElement";
5
- import type Scene from "../scene/Scene";
6
- import { type Heading } from "./heading";
7
- import type { LocalPoint } from "@excalidraw/math";
8
- import { type GlobalPoint } from "@excalidraw/math";
8
+ import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
9
9
  export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
10
  export type SuggestedPointBinding = [
11
11
  NonDeleted<ExcalidrawLinearElement>,
@@ -16,36 +16,47 @@ export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEv
16
16
  export declare const isBindingEnabled: (appState: AppState) => boolean;
17
17
  export declare const FIXED_BINDING_DISTANCE = 5;
18
18
  export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
19
- export declare const BINDING_HIGHLIGHT_OFFSET = 4;
20
- export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap, scene: Scene) => void;
21
- export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null, zoom?: AppState["zoom"]) => void;
19
+ export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
20
+ export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
22
21
  export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
22
+ export declare const maybeSuggestBindingsForLinearElementAtCoords: (linearElement: NonDeleted<ExcalidrawLinearElement>, pointerCoords: {
23
+ x: number;
24
+ y: number;
25
+ }[], scene: Scene, zoom: AppState["zoom"], oppositeBindingBoundElement?: ExcalidrawBindableElement | null) => ExcalidrawBindableElement[];
23
26
  export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
24
27
  x: number;
25
28
  y: number;
26
- }, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[]) => void;
27
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
29
+ }, scene: Scene) => void;
30
+ export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
28
31
  export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
29
32
  export declare const getHoveredElementForBinding: (pointerCoords: {
30
33
  x: number;
31
34
  y: number;
32
35
  }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
33
- export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, options?: {
36
+ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
37
+ simultaneouslyUpdated?: readonly ExcalidrawElement[];
38
+ newSize?: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ changedElements?: Map<string, ExcalidrawElement>;
43
+ }) => void;
44
+ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
34
45
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
35
46
  newSize?: {
36
47
  width: number;
37
48
  height: number;
38
49
  };
39
- changedElements?: Map<string, OrderedExcalidrawElement>;
50
+ zoom?: AppState["zoom"];
40
51
  }) => void;
41
- export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, elementsMap: ElementsMap, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
42
- export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement | undefined, startOrEnd: "start" | "end") => GlobalPoint;
43
- export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
44
- export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
52
+ export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
53
+ export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => GlobalPoint;
54
+ export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
55
+ export declare const snapToMid: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number) => GlobalPoint;
45
56
  export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
46
57
  fixedPoint: FixedPoint;
47
58
  };
48
- export declare const fixBindingsAfterDuplication: (sceneElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatesServeAsOld?: "duplicatesServeAsOld" | undefined) => void;
59
+ export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
49
60
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
50
61
  export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
51
62
  x: number;
@@ -93,7 +104,7 @@ export declare class BindableElement {
93
104
  */
94
105
  static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
95
106
  }
96
- export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement) => GlobalPoint;
107
+ export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
97
108
  export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
98
109
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
99
110
  export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
@@ -1,7 +1,7 @@
1
- import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
1
+ import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
2
+ import type { AppState } from "@excalidraw/excalidraw/types";
2
3
  import type { Drawable, Op } from "roughjs/bin/core";
3
- import type { AppState } from "../types";
4
- import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
4
+ import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
5
5
  export type RectangleBox = {
6
6
  x: number;
7
7
  y: number;
@@ -26,10 +26,16 @@ export type SceneBounds = readonly [
26
26
  ];
27
27
  export declare class ElementBounds {
28
28
  private static boundsCache;
29
- static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap): Bounds;
29
+ private static nonRotatedBoundsCache;
30
+ static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean): Bounds;
30
31
  private static calculateBounds;
31
32
  }
32
33
  export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
34
+ /**
35
+ * Given an element, return the line segments that make up the element.
36
+ *
37
+ * Uses helpers from /math
38
+ */
33
39
  export declare const getElementLineSegments: (element: ExcalidrawElement, elementsMap: ElementsMap) => LineSegment<GlobalPoint>[];
34
40
  /**
35
41
  * Scene -> Scene coords, but in x1,x2,y1,y2 format.
@@ -38,6 +44,7 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
38
44
  */
39
45
  export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
40
46
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
47
+ export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
41
48
  export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((p: GlobalPoint) => GlobalPoint) | undefined) => Bounds;
42
49
  export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
43
50
  /** @returns number in pixels */
@@ -45,8 +52,8 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
45
52
  /** @returns number in degrees */
46
53
  export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
47
54
  export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
48
- export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
49
- export declare const getCommonBounds: (elements: readonly ExcalidrawElement[], elementsMap?: ElementsMap) => Bounds;
55
+ export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
56
+ export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
50
57
  export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
51
58
  x: number;
52
59
  y: number;
@@ -73,4 +80,10 @@ export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | read
73
80
  */
74
81
  export declare const getVisibleSceneBounds: ({ scrollX, scrollY, width, height, zoom, }: AppState) => SceneBounds;
75
82
  export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
83
+ /**
84
+ * Get the axis-aligned bounding box for a given element
85
+ */
86
+ export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
87
+ export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
76
88
  export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
89
+ export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
@@ -0,0 +1,32 @@
1
+ import type { GlobalPoint, LineSegment } from "@excalidraw/math";
2
+ import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
3
+ import type { ElementsMap, ExcalidrawElement } from "./types";
4
+ export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
5
+ export type HitTestArgs = {
6
+ point: GlobalPoint;
7
+ element: ExcalidrawElement;
8
+ threshold: number;
9
+ elementsMap: ElementsMap;
10
+ frameNameBound?: FrameNameBounds | null;
11
+ };
12
+ export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
13
+ export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
14
+ export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
15
+ export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
16
+ /**
17
+ * Intersect a line with an element for binding test
18
+ *
19
+ * @param element
20
+ * @param line
21
+ * @param offset
22
+ * @returns
23
+ */
24
+ export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, elementsMap: ElementsMap, line: LineSegment<GlobalPoint>, offset?: number, onlyFirst?: boolean) => GlobalPoint[];
25
+ /**
26
+ * Check if the given point is considered inside the element's border
27
+ *
28
+ * @param point
29
+ * @param element
30
+ * @returns
31
+ */
32
+ export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
@@ -1,4 +1,4 @@
1
- import type { ElementOrToolType } from "../types";
1
+ import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
2
  export declare const hasBackground: (type: ElementOrToolType) => boolean;
3
3
  export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
4
4
  export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
@@ -1,7 +1,7 @@
1
1
  import type { TransformHandleType } from "./transformHandles";
2
2
  import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
3
3
  export declare const MINIMAL_CROP_SIZE = 10;
4
- export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
4
+ export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
5
5
  x: number;
6
6
  y: number;
7
7
  width: number;