@excalidraw/excalidraw 0.18.0-817d8c5 → 0.18.0-835eb8d

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 (302) 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-FB2NA5UG.js +4132 -0
  5. package/dist/dev/chunk-FB2NA5UG.js.map +7 -0
  6. package/dist/dev/chunk-N4PQJPAH.js +5666 -0
  7. package/dist/dev/chunk-N4PQJPAH.js.map +7 -0
  8. package/dist/dev/{chunk-LMHBUWQS.js → chunk-PWQMCSHA.js} +27 -8
  9. package/dist/dev/chunk-PWQMCSHA.js.map +7 -0
  10. package/dist/dev/data/{image-V26YBSDB.js → image-RT6RLBUE.js} +3 -3
  11. package/dist/dev/index.css +3573 -3309
  12. package/dist/dev/index.css.map +3 -3
  13. package/dist/dev/index.js +31657 -23863
  14. package/dist/dev/index.js.map +4 -4
  15. package/dist/dev/locales/{en-OZCJJ2HN.js → en-V3NQTBPG.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-GF46JCB3.js +12 -0
  20. package/dist/prod/chunk-LS7FJGPW.js +86 -0
  21. package/dist/prod/chunk-SVEJI6WL.js +4 -0
  22. package/dist/prod/data/image-HPGPBQV2.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-LQE6K457.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 +49 -12
  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 +25 -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 +20 -7
  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} +78 -41
  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 +58 -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/element/src/positionElementsOnGrid.d.ts +2 -0
  64. package/dist/types/{excalidraw/renderer → element/src}/renderElement.d.ts +6 -3
  65. package/dist/types/{excalidraw/element → element/src}/resizeElements.d.ts +7 -6
  66. package/dist/types/{excalidraw/element → element/src}/resizeTest.d.ts +4 -4
  67. package/dist/types/{excalidraw/scene → element/src}/selection.d.ts +13 -7
  68. package/dist/types/element/src/shape.d.ts +42 -0
  69. package/dist/types/{excalidraw/element → element/src}/showSelectedShapeActions.d.ts +1 -1
  70. package/dist/types/{excalidraw/element → element/src}/sizeHelpers.d.ts +3 -3
  71. package/dist/types/element/src/store.d.ts +237 -0
  72. package/dist/types/{excalidraw/element → element/src}/textElement.d.ts +8 -7
  73. package/dist/types/{excalidraw/element → element/src}/transformHandles.d.ts +7 -7
  74. package/dist/types/{excalidraw/element → element/src}/typeChecks.d.ts +21 -3
  75. package/dist/types/{excalidraw/element → element/src}/types.d.ts +17 -4
  76. package/dist/types/element/src/utils.d.ts +31 -0
  77. package/dist/types/{excalidraw → element/src}/zindex.d.ts +5 -4
  78. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +103 -109
  79. package/dist/types/excalidraw/actions/actionAlign.d.ts +7 -7
  80. package/dist/types/excalidraw/actions/actionBoundText.d.ts +74 -78
  81. package/dist/types/excalidraw/actions/actionCanvas.d.ts +653 -502
  82. package/dist/types/excalidraw/actions/actionClipboard.d.ts +218 -228
  83. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +36 -38
  84. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +108 -113
  85. package/dist/types/excalidraw/actions/actionDistribute.d.ts +3 -3
  86. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -7
  87. package/dist/types/excalidraw/actions/actionElementLink.d.ts +39 -41
  88. package/dist/types/excalidraw/actions/actionElementLock.d.ts +86 -92
  89. package/dist/types/excalidraw/{element/embeddable.d.ts → actions/actionEmbeddable.d.ts} +36 -48
  90. package/dist/types/excalidraw/actions/actionExport.d.ts +369 -387
  91. package/dist/types/excalidraw/actions/actionFinalize.d.ts +104 -67
  92. package/dist/types/excalidraw/actions/actionFlip.d.ts +3 -3
  93. package/dist/types/excalidraw/actions/actionFrame.d.ts +260 -268
  94. package/dist/types/excalidraw/actions/actionGroup.d.ts +71 -75
  95. package/dist/types/excalidraw/actions/actionHistory.d.ts +2 -3
  96. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +564 -42
  97. package/dist/types/excalidraw/actions/actionLink.d.ts +37 -39
  98. package/dist/types/excalidraw/actions/actionMenu.d.ts +104 -110
  99. package/dist/types/excalidraw/actions/actionNavigate.d.ts +69 -73
  100. package/dist/types/excalidraw/actions/actionProperties.d.ts +512 -525
  101. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +37 -39
  102. package/dist/types/excalidraw/actions/actionStyles.d.ts +38 -40
  103. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  104. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +36 -38
  105. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +36 -38
  106. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +35 -209
  107. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  108. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +35 -38
  109. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +36 -39
  110. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +36 -39
  111. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  112. package/dist/types/excalidraw/actions/index.d.ts +2 -1
  113. package/dist/types/excalidraw/actions/manager.d.ts +2 -2
  114. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  115. package/dist/types/excalidraw/actions/types.d.ts +6 -5
  116. package/dist/types/excalidraw/animated-trail.d.ts +7 -1
  117. package/dist/types/excalidraw/appState.d.ts +39 -28
  118. package/dist/types/excalidraw/charts.d.ts +1 -1
  119. package/dist/types/excalidraw/clipboard.d.ts +71 -8
  120. package/dist/types/excalidraw/components/Actions.d.ts +10 -7
  121. package/dist/types/excalidraw/components/App.d.ts +51 -32
  122. package/dist/types/excalidraw/components/Avatar.d.ts +1 -1
  123. package/dist/types/excalidraw/components/ButtonIcon.d.ts +2 -1
  124. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  125. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +11 -6
  126. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  127. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +1 -2
  128. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -5
  129. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -4
  130. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -3
  131. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  132. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +4 -4
  133. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  134. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +2 -1
  135. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +1 -1
  136. package/dist/types/excalidraw/components/ContextMenu.d.ts +2 -2
  137. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  138. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  139. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +2 -2
  140. package/dist/types/excalidraw/components/DialogActionButton.d.ts +1 -1
  141. package/dist/types/excalidraw/{element → components}/ElementCanvasButtons.d.ts +1 -1
  142. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +5 -4
  143. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  144. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  145. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +1 -1
  146. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +1 -1
  147. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +3 -2
  148. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +3 -3
  149. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -2
  150. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +1 -1
  151. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  152. package/dist/types/excalidraw/components/IconPicker.d.ts +1 -1
  153. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +2 -2
  154. package/dist/types/excalidraw/components/InitializeApp.d.ts +1 -1
  155. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  156. package/dist/types/excalidraw/components/Island.d.ts +1 -1
  157. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +2 -2
  158. package/dist/types/excalidraw/components/LayerUI.d.ts +3 -3
  159. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -1
  160. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +1 -1
  161. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +4 -4
  162. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -2
  163. package/dist/types/excalidraw/components/LoadingMessage.d.ts +1 -1
  164. package/dist/types/excalidraw/components/MagicButton.d.ts +1 -1
  165. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -3
  166. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +1 -1
  167. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  168. package/dist/types/excalidraw/components/PublishLibrary.d.ts +1 -1
  169. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  170. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  171. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  172. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -1
  173. package/dist/types/excalidraw/components/Sidebar/common.d.ts +1 -1
  174. package/dist/types/excalidraw/components/Stack.d.ts +1 -1
  175. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  176. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  177. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  178. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  179. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +14 -4
  180. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +2 -2
  181. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  182. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +3 -3
  183. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +2 -2
  184. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  185. package/dist/types/excalidraw/components/Stats/Position.d.ts +2 -2
  186. package/dist/types/excalidraw/components/Stats/index.d.ts +2 -2
  187. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  188. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
  189. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +1 -1
  190. package/dist/types/excalidraw/components/TextField.d.ts +2 -1
  191. package/dist/types/excalidraw/components/Toast.d.ts +1 -1
  192. package/dist/types/excalidraw/components/ToolButton.d.ts +2 -2
  193. package/dist/types/excalidraw/components/Tooltip.d.ts +1 -1
  194. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  195. package/dist/types/excalidraw/components/UserList.d.ts +1 -1
  196. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -3
  197. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -2
  198. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +3 -3
  199. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +1 -1
  200. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +2 -2
  201. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +1 -1
  202. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +5 -4
  203. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -2
  204. package/dist/types/excalidraw/components/icons.d.ts +11 -1
  205. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  206. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +4 -1
  207. package/dist/types/excalidraw/components/shapes.d.ts +190 -0
  208. package/dist/types/excalidraw/context/tunnels.d.ts +1 -1
  209. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +1 -1
  210. package/dist/types/excalidraw/data/blob.d.ts +7 -11
  211. package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
  212. package/dist/types/excalidraw/data/index.d.ts +2 -2
  213. package/dist/types/excalidraw/data/json.d.ts +1 -1
  214. package/dist/types/excalidraw/data/library.d.ts +3 -3
  215. package/dist/types/excalidraw/data/reconcile.d.ts +3 -2
  216. package/dist/types/excalidraw/data/resave.d.ts +1 -1
  217. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  218. package/dist/types/excalidraw/data/transform.d.ts +4 -4
  219. package/dist/types/excalidraw/data/types.d.ts +6 -3
  220. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  221. package/dist/types/excalidraw/eraser/index.d.ts +12 -0
  222. package/dist/types/excalidraw/errors.d.ts +0 -3
  223. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -13
  224. package/dist/types/excalidraw/history.d.ts +31 -23
  225. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  226. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  227. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  228. package/dist/types/excalidraw/i18n.d.ts +1 -1
  229. package/dist/types/excalidraw/index.d.ts +18 -16
  230. package/dist/types/excalidraw/laser-trails.d.ts +1 -1
  231. package/dist/types/excalidraw/lasso/index.d.ts +16 -0
  232. package/dist/types/excalidraw/lasso/utils.d.ts +13 -0
  233. package/dist/types/excalidraw/renderer/helpers.d.ts +8 -3
  234. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  235. package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +2 -2
  236. package/dist/types/excalidraw/scene/Renderer.d.ts +3 -4
  237. package/dist/types/excalidraw/scene/export.d.ts +1 -1
  238. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  239. package/dist/types/excalidraw/scene/scroll.d.ts +1 -1
  240. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  241. package/dist/types/excalidraw/scene/types.d.ts +6 -4
  242. package/dist/types/excalidraw/snapping.d.ts +5 -6
  243. package/dist/types/excalidraw/types.d.ts +50 -26
  244. package/dist/types/excalidraw/{element → wysiwyg}/textWysiwyg.d.ts +4 -2
  245. package/dist/types/math/{angle.d.ts → src/angle.d.ts} +2 -0
  246. package/dist/types/math/src/constants.d.ts +3 -0
  247. package/dist/types/math/src/curve.d.ts +74 -0
  248. package/dist/types/math/{index.d.ts → src/index.d.ts} +1 -0
  249. package/dist/types/math/{point.d.ts → src/point.d.ts} +3 -3
  250. package/dist/types/math/{polygon.d.ts → src/polygon.d.ts} +1 -0
  251. package/dist/types/math/{rectangle.d.ts → src/rectangle.d.ts} +2 -0
  252. package/dist/types/math/{segment.d.ts → src/segment.d.ts} +2 -1
  253. package/dist/types/math/{types.d.ts → src/types.d.ts} +1 -0
  254. package/dist/types/math/{vector.d.ts → src/vector.d.ts} +8 -2
  255. package/dist/types/utils/{bbox.d.ts → src/bbox.d.ts} +1 -1
  256. package/dist/types/utils/{export.d.ts → src/export.d.ts} +2 -2
  257. package/dist/types/utils/{index.d.ts → src/index.d.ts} +1 -1
  258. package/dist/types/utils/{geometry → src}/shape.d.ts +2 -15
  259. package/dist/types/utils/{withinBounds.d.ts → src/withinBounds.d.ts} +2 -2
  260. package/history.ts +148 -109
  261. package/package.json +26 -11
  262. package/dist/dev/chunk-3SN6HYVK.js +0 -25695
  263. package/dist/dev/chunk-3SN6HYVK.js.map +0 -7
  264. package/dist/dev/chunk-53KHN5WM.js +0 -7
  265. package/dist/dev/chunk-53KHN5WM.js.map +0 -7
  266. package/dist/dev/chunk-LMHBUWQS.js.map +0 -7
  267. package/dist/dev/chunk-OKSO7T74.js +0 -4132
  268. package/dist/dev/chunk-OKSO7T74.js.map +0 -7
  269. package/dist/prod/chunk-36CXSE6H.js +0 -34
  270. package/dist/prod/chunk-6U3AYISY.js +0 -12
  271. package/dist/prod/chunk-EIO257PC.js +0 -86
  272. package/dist/prod/chunk-G5N3DNGT.js +0 -7
  273. package/dist/prod/data/image-N4WCURRR.js +0 -1
  274. package/dist/types/excalidraw/align.d.ts +0 -7
  275. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  276. package/dist/types/excalidraw/element/collision.d.ts +0 -26
  277. package/dist/types/excalidraw/element/distance.d.ts +0 -3
  278. package/dist/types/excalidraw/element/index.d.ts +0 -26
  279. package/dist/types/excalidraw/element/mutateElement.d.ts +0 -13
  280. package/dist/types/excalidraw/element/utils.d.ts +0 -21
  281. package/dist/types/excalidraw/scene/Shape.d.ts +0 -17
  282. package/dist/types/excalidraw/scene/ShapeCache.d.ts +0 -25
  283. package/dist/types/excalidraw/shapes.d.ts +0 -85
  284. package/dist/types/excalidraw/store.d.ts +0 -129
  285. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  286. package/dist/types/math/curve.d.ts +0 -40
  287. package/dist/types/utils/collision.d.ts +0 -9
  288. /package/dist/dev/data/{image-V26YBSDB.js.map → image-RT6RLBUE.js.map} +0 -0
  289. /package/dist/dev/locales/{en-OZCJJ2HN.js.map → en-V3NQTBPG.js.map} +0 -0
  290. /package/dist/types/{excalidraw → common/src}/keys.d.ts +0 -0
  291. /package/dist/types/{excalidraw → common/src}/queue.d.ts +0 -0
  292. /package/dist/types/{excalidraw → common/src}/random.d.ts +0 -0
  293. /package/dist/types/{excalidraw/data → common/src}/url.d.ts +0 -0
  294. /package/dist/types/{excalidraw/element → element/src}/containerCache.d.ts +0 -0
  295. /package/dist/types/{excalidraw/element → element/src}/sortElements.d.ts +0 -0
  296. /package/dist/types/{excalidraw/element → element/src}/textMeasurements.d.ts +0 -0
  297. /package/dist/types/{excalidraw/element → element/src}/textWrapping.d.ts +0 -0
  298. /package/dist/types/math/{ellipse.d.ts → src/ellipse.d.ts} +0 -0
  299. /package/dist/types/math/{line.d.ts → src/line.d.ts} +0 -0
  300. /package/dist/types/math/{range.d.ts → src/range.d.ts} +0 -0
  301. /package/dist/types/math/{triangle.d.ts → src/triangle.d.ts} +0 -0
  302. /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-GF46JCB3.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;
@@ -8,10 +8,12 @@ export declare const isChrome: boolean;
8
8
  export declare const isSafari: boolean;
9
9
  export declare const isIOS: boolean;
10
10
  export declare const isBrave: () => boolean;
11
+ export declare const isMobile: boolean;
11
12
  export declare const supportsResizeObserver: boolean;
12
13
  export declare const APP_NAME = "Excalidraw";
13
14
  export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
14
15
  export declare const DRAGGING_THRESHOLD = 10;
16
+ export declare const MINIMUM_ARROW_SIZE = 20;
15
17
  export declare const LINE_CONFIRM_THRESHOLD = 8;
16
18
  export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
17
19
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
@@ -82,11 +84,15 @@ export declare const YOUTUBE_STATES: {
82
84
  export declare const ENV: {
83
85
  TEST: string;
84
86
  DEVELOPMENT: string;
87
+ PRODUCTION: string;
85
88
  };
86
89
  export declare const CLASSES: {
90
+ SIDEBAR: string;
87
91
  SHAPE_ACTIONS_MENU: string;
88
92
  ZOOM_ACTIONS: string;
89
93
  SEARCH_MENU_INPUT_WRAPPER: string;
94
+ CONVERT_ELEMENT_TYPE_POPUP: string;
95
+ SHAPE_ACTIONS_THEME_SCOPE: string;
90
96
  };
91
97
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
92
98
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -107,11 +113,21 @@ export declare const FONT_FAMILY: {
107
113
  "Lilita One": number;
108
114
  "Comic Shanns": number;
109
115
  "Liberation Sans": number;
116
+ Assistant: number;
117
+ };
118
+ export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
119
+ export declare const MONOSPACE_GENERIC_FONT = "monospace";
120
+ export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
121
+ "sans-serif": number;
122
+ monospace: number;
110
123
  };
111
124
  export declare const FONT_FAMILY_FALLBACKS: {
112
- Xiaolai: number;
113
125
  "Segoe UI Emoji": number;
126
+ "sans-serif": number;
127
+ monospace: number;
128
+ Xiaolai: number;
114
129
  };
130
+ export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
115
131
  export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
116
132
  export declare const THEME: {
117
133
  readonly LIGHT: "light";
@@ -120,11 +136,11 @@ export declare const THEME: {
120
136
  export declare const FRAME_STYLE: {
121
137
  strokeColor: string;
122
138
  strokeWidth: number;
123
- strokeStyle: import("./element/types").StrokeStyle;
124
- fillStyle: import("./element/types").FillStyle;
139
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
140
+ fillStyle: import("@excalidraw/element/types").FillStyle;
125
141
  roughness: number;
126
142
  roundness: {
127
- type: import("./element/types").RoundnessType;
143
+ type: import("@excalidraw/element/types").RoundnessType;
128
144
  value?: number | undefined;
129
145
  } | null;
130
146
  backgroundColor: string;
@@ -162,6 +178,14 @@ export declare const IMAGE_MIME_TYPES: {
162
178
  readonly avif: "image/avif";
163
179
  readonly jfif: "image/jfif";
164
180
  };
181
+ export declare const STRING_MIME_TYPES: {
182
+ readonly text: "text/plain";
183
+ readonly html: "text/html";
184
+ readonly json: "application/json";
185
+ readonly excalidraw: "application/vnd.excalidraw+json";
186
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
187
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
188
+ };
165
189
  export declare const MIME_TYPES: {
166
190
  readonly svg: "image/svg+xml";
167
191
  readonly png: "image/png";
@@ -172,14 +196,15 @@ export declare const MIME_TYPES: {
172
196
  readonly ico: "image/x-icon";
173
197
  readonly avif: "image/avif";
174
198
  readonly jfif: "image/jfif";
199
+ readonly "excalidraw.svg": "image/svg+xml";
200
+ readonly "excalidraw.png": "image/png";
201
+ readonly binary: "application/octet-stream";
175
202
  readonly text: "text/plain";
176
203
  readonly html: "text/html";
177
204
  readonly json: "application/json";
178
205
  readonly excalidraw: "application/vnd.excalidraw+json";
179
206
  readonly excalidrawlib: "application/vnd.excalidrawlib+json";
180
- readonly "excalidraw.svg": "image/svg+xml";
181
- readonly "excalidraw.png": "image/png";
182
- readonly binary: "application/octet-stream";
207
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
183
208
  };
184
209
  export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
185
210
  export declare const EXPORT_IMAGE_TYPES: {
@@ -193,7 +218,7 @@ export declare const EXPORT_DATA_TYPES: {
193
218
  readonly excalidrawLibrary: "excalidrawlib";
194
219
  readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
195
220
  };
196
- export declare const EXPORT_SOURCE: string;
221
+ export declare const getExportSource: () => string;
197
222
  export declare const IMAGE_RENDER_TIMEOUT = 500;
198
223
  export declare const TAP_TWICE_TIMEOUT = 300;
199
224
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -214,9 +239,12 @@ export declare const URL_HASH_KEYS: {
214
239
  readonly addLibrary: "addLibrary";
215
240
  };
216
241
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
217
- export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
242
+ export declare const MQ_MAX_MOBILE = 599;
218
243
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
219
244
  export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
245
+ export declare const MQ_MIN_TABLET: number;
246
+ export declare const MQ_MAX_TABLET = 1400;
247
+ export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
220
248
  export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
221
249
  export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
222
250
  export declare const EXPORT_SCALES: number[];
@@ -224,6 +252,7 @@ export declare const DEFAULT_EXPORT_PADDING = 10;
224
252
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
225
253
  export declare const MAX_ALLOWED_FILE_BYTES: number;
226
254
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
255
+ 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
256
  export declare const ENCRYPTION_KEY_BITS = 128;
228
257
  export declare const VERSIONS: {
229
258
  readonly excalidraw: 2;
@@ -276,9 +305,10 @@ export declare const DEFAULT_SIDEBAR: {
276
305
  readonly name: "default";
277
306
  readonly defaultTab: "library";
278
307
  };
279
- export declare const LIBRARY_DISABLED_TYPES: Set<"image" | "iframe" | "embeddable">;
308
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
280
309
  export declare const TOOL_TYPE: {
281
310
  readonly selection: "selection";
311
+ readonly lasso: "lasso";
282
312
  readonly rectangle: "rectangle";
283
313
  readonly diamond: "diamond";
284
314
  readonly ellipse: "ellipse";
@@ -321,3 +351,10 @@ export declare enum UserIdleState {
321
351
  AWAY = "away",
322
352
  IDLE = "idle"
323
353
  }
354
+ /**
355
+ * distance at which we merge points instead of adding a new merge-point
356
+ * when converting a line to a polygon (merge currently means overlaping
357
+ * the start and end points)
358
+ */
359
+ export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
360
+ export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
@@ -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;
@@ -17,6 +17,8 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
17
17
  fontSize: number;
18
18
  fontFamily: FontFamilyValues;
19
19
  }) => FontString;
20
+ /** executes callback in the frame that's after the current one */
21
+ export declare const nextAnimationFrame: (cb: () => any) => Promise<void>;
20
22
  export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
21
23
  (...args: T): void;
22
24
  flush(): void;
@@ -87,6 +89,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
87
89
  customType: string;
88
90
  }) & {
89
91
  locked?: boolean;
92
+ fromSelection?: boolean;
90
93
  }) & {
91
94
  lastActiveToolBeforeEraser?: ActiveTool | null;
92
95
  }) => AppState["activeTool"];
@@ -136,6 +139,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
136
139
  export declare const muteFSAbortError: (error?: Error) => void;
137
140
  export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
138
141
  export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
142
+ /** returns the first non-null mapped value */
143
+ export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
139
144
  export declare const isTransparent: (color: string) => boolean;
140
145
  export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
141
146
  export type ResolvablePromise<T> = Promise<T> & {
@@ -176,8 +181,18 @@ export type Node<T> = T & {
176
181
  * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
177
182
  */
178
183
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
184
+ /**
185
+ * Converts a readonly array or map into an iterable.
186
+ * Useful for avoiding entry allocations when iterating object / map on each iteration.
187
+ */
188
+ export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
189
+ /**
190
+ * Converts a readonly array or map into an array.
191
+ */
192
+ export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
179
193
  export declare const isTestEnv: () => boolean;
180
194
  export declare const isDevEnv: () => boolean;
195
+ export declare const isProdEnv: () => boolean;
181
196
  export declare const isServerEnv: () => boolean;
182
197
  export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
183
198
  nativeEvent: T;
@@ -241,16 +256,15 @@ export declare const toBrandedType: <BrandedType, CurrentType = BrandedType>(val
241
256
  export declare const promiseTry: <TValue, TArgs extends unknown[]>(fn: (...args: TArgs) => TValue | PromiseLike<TValue>, ...args: TArgs) => Promise<TValue>;
242
257
  export declare const isAnyTrue: (...args: boolean[]) => boolean;
243
258
  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
259
  /**
251
260
  * use when you need to render unsafe string as HTML attribute, but MAKE SURE
252
261
  * the attribute is double-quoted when constructing the HTML string
253
262
  */
254
263
  export declare const escapeDoubleQuotes: (str: string) => string;
255
264
  export declare const castArray: <T>(value: T | T[]) => T[];
265
+ /** hack for Array.isArray type guard not working with readonly value[] */
266
+ export declare const isReadonlyArray: (value?: any) => value is readonly any[];
267
+ export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
268
+ export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
269
+ export declare const isMobileOrTablet: () => boolean;
256
270
  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;
@@ -67,10 +74,16 @@ export interface BoundingBox {
67
74
  width: number;
68
75
  height: number;
69
76
  }
70
- export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
77
+ export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
71
78
  /**
72
79
  * returns scene coords of user's editor viewport (visible canvas area) bounds
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;