@excalidraw/excalidraw 0.17.1-d9bbf1e → 0.17.1-e63dd02

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 (416) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/browser/dev/excalidraw-assets-dev/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
  3. package/dist/browser/dev/excalidraw-assets-dev/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
  4. package/dist/browser/dev/excalidraw-assets-dev/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
  5. package/dist/browser/dev/excalidraw-assets-dev/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
  6. package/dist/browser/dev/excalidraw-assets-dev/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
  7. package/dist/browser/dev/excalidraw-assets-dev/{chunk-XOM7LNOU.js → chunk-IT7T3AIK.js} +49 -8
  8. package/dist/browser/dev/excalidraw-assets-dev/chunk-IT7T3AIK.js.map +7 -0
  9. package/dist/browser/dev/excalidraw-assets-dev/{chunk-BLEB3M62.js → chunk-RNHSD5AR.js} +7668 -2142
  10. package/dist/browser/dev/excalidraw-assets-dev/chunk-RNHSD5AR.js.map +7 -0
  11. package/dist/browser/dev/excalidraw-assets-dev/{dist-ITJNUBZF.js → dist-DNSPZDOZ.js} +66 -32
  12. package/dist/browser/dev/excalidraw-assets-dev/dist-DNSPZDOZ.js.map +7 -0
  13. package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js → en-XV7OZCPP.js} +8 -2
  14. package/dist/browser/dev/excalidraw-assets-dev/{image-ZGDDRBEN.js → image-77HZYGLG.js} +2 -2
  15. package/dist/browser/dev/excalidraw-assets-dev/{image-O66MQ7WQ.css → image-WDHYGKKP.css} +1 -1
  16. package/dist/browser/dev/excalidraw-assets-dev/{image-O66MQ7WQ.css.map → image-WDHYGKKP.css.map} +2 -2
  17. package/dist/browser/dev/index.css +610 -180
  18. package/dist/browser/dev/index.css.map +3 -3
  19. package/dist/browser/dev/index.js +13306 -8006
  20. package/dist/browser/dev/index.js.map +4 -4
  21. package/dist/browser/prod/excalidraw-assets/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
  22. package/dist/browser/prod/excalidraw-assets/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
  23. package/dist/browser/prod/excalidraw-assets/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
  24. package/dist/browser/prod/excalidraw-assets/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
  25. package/dist/browser/prod/excalidraw-assets/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
  26. package/dist/browser/prod/excalidraw-assets/chunk-OYEADJSR.js +63 -0
  27. package/dist/browser/prod/excalidraw-assets/{chunk-5SYIAZGL.js → chunk-PDYFZJMS.js} +5 -5
  28. package/dist/browser/prod/excalidraw-assets/dist-NLUQPPQQ.js +7 -0
  29. package/dist/browser/prod/excalidraw-assets/en-YVAVVILW.js +1 -0
  30. package/dist/browser/prod/excalidraw-assets/image-X3GFZHNN.js +1 -0
  31. package/dist/browser/prod/index.css +1 -1
  32. package/dist/browser/prod/index.js +70 -51
  33. package/dist/dev/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
  34. package/dist/dev/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
  35. package/dist/dev/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
  36. package/dist/dev/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
  37. package/dist/dev/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
  38. package/dist/dev/{en-XW4JO6VX.json → en-YNVBSAIL.json} +42 -7
  39. package/dist/dev/index.css +610 -180
  40. package/dist/dev/index.css.map +3 -3
  41. package/dist/dev/index.js +22165 -16833
  42. package/dist/dev/index.js.map +4 -4
  43. package/dist/excalidraw/actions/actionAddToLibrary.d.ts +24 -9
  44. package/dist/excalidraw/actions/actionAlign.d.ts +8 -8
  45. package/dist/excalidraw/actions/actionBoundText.d.ts +20 -10
  46. package/dist/excalidraw/actions/actionBoundText.js +3 -1
  47. package/dist/excalidraw/actions/actionCanvas.d.ts +100 -40
  48. package/dist/excalidraw/actions/actionCanvas.js +1 -1
  49. package/dist/excalidraw/actions/actionClipboard.d.ts +62 -26
  50. package/dist/excalidraw/actions/actionDeleteSelected.d.ts +28 -12
  51. package/dist/excalidraw/actions/actionDeleteSelected.js +24 -5
  52. package/dist/excalidraw/actions/actionDistribute.d.ts +4 -4
  53. package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +3 -3
  54. package/dist/excalidraw/actions/actionDuplicateSelection.js +1 -2
  55. package/dist/excalidraw/actions/actionElementLock.d.ts +17 -7
  56. package/dist/excalidraw/actions/actionExport.d.ts +75 -30
  57. package/dist/excalidraw/actions/actionFinalize.d.ts +17 -7
  58. package/dist/excalidraw/actions/actionFinalize.js +2 -2
  59. package/dist/excalidraw/actions/actionFlip.d.ts +4 -4
  60. package/dist/excalidraw/actions/actionFlip.js +2 -2
  61. package/dist/excalidraw/actions/actionFrame.d.ts +338 -10
  62. package/dist/excalidraw/actions/actionGroup.d.ts +324 -4
  63. package/dist/excalidraw/actions/actionHistory.d.ts +3 -3
  64. package/dist/excalidraw/actions/actionHistory.js +8 -8
  65. package/dist/excalidraw/actions/actionLinearEditor.d.ts +12 -5
  66. package/dist/excalidraw/actions/actionLinearEditor.js +21 -5
  67. package/dist/excalidraw/actions/actionLink.d.ts +8 -3
  68. package/dist/excalidraw/actions/actionMenu.d.ts +24 -9
  69. package/dist/excalidraw/actions/actionNavigate.d.ts +17 -7
  70. package/dist/excalidraw/actions/actionProperties.d.ts +476 -82
  71. package/dist/excalidraw/actions/actionProperties.js +384 -59
  72. package/dist/excalidraw/actions/actionSelectAll.d.ts +9 -4
  73. package/dist/excalidraw/actions/actionStyles.d.ts +12 -4
  74. package/dist/excalidraw/actions/actionStyles.js +3 -2
  75. package/dist/excalidraw/actions/actionTextAutoResize.d.ts +17 -0
  76. package/dist/excalidraw/actions/actionTextAutoResize.js +38 -0
  77. package/dist/excalidraw/actions/actionToggleGridMode.d.ts +9 -4
  78. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -3
  79. package/dist/excalidraw/actions/actionToggleStats.d.ts +9 -3
  80. package/dist/excalidraw/actions/actionToggleStats.js +4 -3
  81. package/dist/excalidraw/actions/actionToggleViewMode.d.ts +8 -3
  82. package/dist/excalidraw/actions/actionToggleZenMode.d.ts +8 -3
  83. package/dist/excalidraw/actions/actionZindex.d.ts +8 -4
  84. package/dist/excalidraw/actions/actionZindex.js +4 -0
  85. package/dist/excalidraw/actions/manager.d.ts +3 -3
  86. package/dist/excalidraw/actions/register.d.ts +1 -1
  87. package/dist/excalidraw/actions/shortcuts.d.ts +2 -2
  88. package/dist/excalidraw/actions/types.d.ts +6 -6
  89. package/dist/excalidraw/align.d.ts +1 -1
  90. package/dist/excalidraw/analytics.js +9 -7
  91. package/dist/excalidraw/animated-trail.d.ts +2 -2
  92. package/dist/excalidraw/appState.d.ts +6 -2
  93. package/dist/excalidraw/appState.js +14 -3
  94. package/dist/excalidraw/binaryheap.d.ts +12 -0
  95. package/dist/excalidraw/binaryheap.js +93 -0
  96. package/dist/excalidraw/change.d.ts +6 -5
  97. package/dist/excalidraw/change.js +20 -11
  98. package/dist/excalidraw/charts.d.ts +1 -1
  99. package/dist/excalidraw/charts.js +0 -10
  100. package/dist/excalidraw/clients.d.ts +2 -2
  101. package/dist/excalidraw/clients.js +1 -1
  102. package/dist/excalidraw/clipboard.d.ts +3 -3
  103. package/dist/excalidraw/colors.d.ts +1 -1
  104. package/dist/excalidraw/components/Actions.d.ts +3 -3
  105. package/dist/excalidraw/components/Actions.js +14 -9
  106. package/dist/excalidraw/components/App.d.ts +14 -17
  107. package/dist/excalidraw/components/App.js +356 -217
  108. package/dist/excalidraw/components/ButtonIcon.d.ts +15 -0
  109. package/dist/excalidraw/components/ButtonIcon.js +8 -0
  110. package/dist/excalidraw/components/ButtonIconSelect.js +2 -3
  111. package/dist/excalidraw/components/ButtonSeparator.d.ts +2 -0
  112. package/dist/excalidraw/components/ButtonSeparator.js +7 -0
  113. package/dist/excalidraw/components/CheckboxItem.js +1 -1
  114. package/dist/excalidraw/components/ColorPicker/ColorInput.d.ts +1 -1
  115. package/dist/excalidraw/components/ColorPicker/ColorInput.js +1 -1
  116. package/dist/excalidraw/components/ColorPicker/ColorPicker.d.ts +4 -4
  117. package/dist/excalidraw/components/ColorPicker/ColorPicker.js +48 -80
  118. package/dist/excalidraw/components/ColorPicker/Picker.d.ts +3 -3
  119. package/dist/excalidraw/components/ColorPicker/Picker.js +1 -1
  120. package/dist/excalidraw/components/ColorPicker/PickerColorList.d.ts +1 -1
  121. package/dist/excalidraw/components/ColorPicker/PickerHeading.d.ts +1 -1
  122. package/dist/excalidraw/components/ColorPicker/ShadeList.d.ts +1 -1
  123. package/dist/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  124. package/dist/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +2 -2
  125. package/dist/excalidraw/components/ColorPicker/colorPickerUtils.js +1 -1
  126. package/dist/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
  127. package/dist/excalidraw/components/ColorPicker/keyboardNavHandlers.js +1 -1
  128. package/dist/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -1
  129. package/dist/excalidraw/components/CommandPalette/CommandPalette.js +5 -5
  130. package/dist/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -1
  131. package/dist/excalidraw/components/CommandPalette/types.d.ts +3 -3
  132. package/dist/excalidraw/components/ConfirmDialog.d.ts +1 -1
  133. package/dist/excalidraw/components/ContextMenu.d.ts +2 -2
  134. package/dist/excalidraw/components/ContextMenu.js +2 -2
  135. package/dist/excalidraw/components/DarkModeToggle.d.ts +1 -1
  136. package/dist/excalidraw/components/DefaultSidebar.d.ts +2 -2
  137. package/dist/excalidraw/components/Dialog.js +1 -1
  138. package/dist/excalidraw/components/DialogActionButton.d.ts +1 -1
  139. package/dist/excalidraw/components/EyeDropper.d.ts +2 -2
  140. package/dist/excalidraw/components/FollowMode/FollowMode.d.ts +1 -1
  141. package/dist/excalidraw/components/FollowMode/FollowMode.js +1 -1
  142. package/dist/excalidraw/components/FontPicker/FontPicker.d.ts +21 -0
  143. package/dist/excalidraw/components/FontPicker/FontPicker.js +49 -0
  144. package/dist/excalidraw/components/FontPicker/FontPickerList.d.ts +25 -0
  145. package/dist/excalidraw/components/FontPicker/FontPickerList.js +119 -0
  146. package/dist/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +7 -0
  147. package/dist/excalidraw/components/FontPicker/FontPickerTrigger.js +13 -0
  148. package/dist/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +14 -0
  149. package/dist/excalidraw/components/FontPicker/keyboardNavHandlers.js +38 -0
  150. package/dist/excalidraw/components/HelpDialog.js +2 -2
  151. package/dist/excalidraw/components/HintViewer.d.ts +1 -1
  152. package/dist/excalidraw/components/HintViewer.js +6 -3
  153. package/dist/excalidraw/components/IconPicker.js +2 -2
  154. package/dist/excalidraw/components/ImageExportDialog.d.ts +1 -1
  155. package/dist/excalidraw/components/InitializeApp.d.ts +2 -2
  156. package/dist/excalidraw/components/JSONExportDialog.d.ts +3 -3
  157. package/dist/excalidraw/components/LayerUI.d.ts +4 -4
  158. package/dist/excalidraw/components/LayerUI.js +10 -7
  159. package/dist/excalidraw/components/LibraryMenu.d.ts +2 -2
  160. package/dist/excalidraw/components/LibraryMenuBrowseButton.d.ts +1 -1
  161. package/dist/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  162. package/dist/excalidraw/components/LibraryMenuHeaderContent.d.ts +2 -2
  163. package/dist/excalidraw/components/LibraryMenuItems.d.ts +1 -1
  164. package/dist/excalidraw/components/LibraryMenuSection.d.ts +5 -4
  165. package/dist/excalidraw/components/LibraryUnit.d.ts +2 -2
  166. package/dist/excalidraw/components/LoadingMessage.d.ts +1 -1
  167. package/dist/excalidraw/components/MagicSettings.js +2 -2
  168. package/dist/excalidraw/components/MobileMenu.d.ts +3 -3
  169. package/dist/excalidraw/components/MobileMenu.js +2 -6
  170. package/dist/excalidraw/components/Modal.d.ts +1 -1
  171. package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  172. package/dist/excalidraw/components/PasteChartDialog.d.ts +1 -1
  173. package/dist/excalidraw/components/PasteChartDialog.js +1 -1
  174. package/dist/excalidraw/components/PropertiesPopover.d.ts +15 -0
  175. package/dist/excalidraw/components/PropertiesPopover.js +31 -0
  176. package/dist/excalidraw/components/PublishLibrary.d.ts +1 -1
  177. package/dist/excalidraw/components/QuickSearch.d.ts +9 -0
  178. package/dist/excalidraw/components/QuickSearch.js +8 -0
  179. package/dist/excalidraw/components/SVGLayer.d.ts +1 -1
  180. package/dist/excalidraw/components/ScrollableList.d.ts +9 -0
  181. package/dist/excalidraw/components/ScrollableList.js +8 -0
  182. package/dist/excalidraw/components/Sidebar/Sidebar.js +1 -1
  183. package/dist/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -1
  184. package/dist/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -1
  185. package/dist/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -1
  186. package/dist/excalidraw/components/Sidebar/common.d.ts +1 -1
  187. package/dist/excalidraw/components/Stats/Angle.d.ts +12 -0
  188. package/dist/excalidraw/components/Stats/Angle.js +53 -0
  189. package/dist/excalidraw/components/Stats/Collapsible.d.ts +9 -0
  190. package/dist/excalidraw/components/Stats/Collapsible.js +12 -0
  191. package/dist/excalidraw/components/Stats/Dimension.d.ts +12 -0
  192. package/dist/excalidraw/components/Stats/Dimension.js +68 -0
  193. package/dist/excalidraw/components/Stats/DragInput.d.ts +32 -0
  194. package/dist/excalidraw/components/Stats/DragInput.js +174 -0
  195. package/dist/excalidraw/components/Stats/FontSize.d.ts +12 -0
  196. package/dist/excalidraw/components/Stats/FontSize.js +50 -0
  197. package/dist/excalidraw/components/Stats/MultiAngle.d.ts +12 -0
  198. package/dist/excalidraw/components/Stats/MultiAngle.js +66 -0
  199. package/dist/excalidraw/components/Stats/MultiDimension.d.ts +15 -0
  200. package/dist/excalidraw/components/Stats/MultiDimension.js +199 -0
  201. package/dist/excalidraw/components/Stats/MultiFontSize.d.ts +13 -0
  202. package/dist/excalidraw/components/Stats/MultiFontSize.js +72 -0
  203. package/dist/excalidraw/components/Stats/MultiPosition.d.ts +15 -0
  204. package/dist/excalidraw/components/Stats/MultiPosition.js +101 -0
  205. package/dist/excalidraw/components/Stats/Position.d.ts +13 -0
  206. package/dist/excalidraw/components/Stats/Position.js +40 -0
  207. package/dist/excalidraw/components/Stats/index.d.ts +16 -0
  208. package/dist/excalidraw/components/Stats/index.js +79 -0
  209. package/dist/excalidraw/components/Stats/utils.d.ts +26 -0
  210. package/dist/excalidraw/components/Stats/utils.js +162 -0
  211. package/dist/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +1 -1
  212. package/dist/excalidraw/components/TTDDialog/TTDDialog.js +2 -2
  213. package/dist/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +1 -1
  214. package/dist/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +1 -1
  215. package/dist/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +1 -1
  216. package/dist/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +1 -1
  217. package/dist/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
  218. package/dist/excalidraw/components/TTDDialog/common.d.ts +5 -5
  219. package/dist/excalidraw/components/TTDDialog/common.js +3 -7
  220. package/dist/excalidraw/components/TextField.d.ts +1 -1
  221. package/dist/excalidraw/components/Toast.d.ts +1 -1
  222. package/dist/excalidraw/components/ToolButton.d.ts +3 -2
  223. package/dist/excalidraw/components/Trans.d.ts +1 -1
  224. package/dist/excalidraw/components/UserList.d.ts +1 -1
  225. package/dist/excalidraw/components/UserList.js +22 -22
  226. package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
  227. package/dist/excalidraw/components/canvases/InteractiveCanvas.js +4 -2
  228. package/dist/excalidraw/components/canvases/StaticCanvas.d.ts +2 -2
  229. package/dist/excalidraw/components/canvases/StaticCanvas.js +3 -2
  230. package/dist/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +12 -3
  231. package/dist/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +24 -4
  232. package/dist/excalidraw/components/dropdownMenu/DropdownMenuItem.js +55 -14
  233. package/dist/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
  234. package/dist/excalidraw/components/dropdownMenu/DropdownMenuItemContent.js +2 -2
  235. package/dist/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  236. package/dist/excalidraw/components/dropdownMenu/common.js +3 -2
  237. package/dist/excalidraw/components/footer/Footer.d.ts +2 -2
  238. package/dist/excalidraw/components/hyperlink/Hyperlink.d.ts +2 -2
  239. package/dist/excalidraw/components/hyperlink/helpers.d.ts +3 -3
  240. package/dist/excalidraw/components/icons.d.ts +10 -2
  241. package/dist/excalidraw/components/icons.js +29 -6
  242. package/dist/excalidraw/components/main-menu/MainMenu.d.ts +12 -3
  243. package/dist/excalidraw/components/welcome-screen/WelcomeScreen.Center.js +2 -2
  244. package/dist/excalidraw/components/welcome-screen/WelcomeScreen.Hints.js +3 -3
  245. package/dist/excalidraw/constants.d.ts +24 -3
  246. package/dist/excalidraw/constants.js +28 -4
  247. package/dist/excalidraw/context/ui-appState.d.ts +1 -1
  248. package/dist/excalidraw/cursor.d.ts +1 -1
  249. package/dist/excalidraw/data/EditorLocalStorage.d.ts +2 -2
  250. package/dist/excalidraw/data/blob.d.ts +5 -5
  251. package/dist/excalidraw/data/filesystem.d.ts +2 -1
  252. package/dist/excalidraw/data/index.d.ts +4 -4
  253. package/dist/excalidraw/data/json.d.ts +3 -3
  254. package/dist/excalidraw/data/library.d.ts +3 -3
  255. package/dist/excalidraw/data/magic.d.ts +3 -3
  256. package/dist/excalidraw/data/reconcile.d.ts +3 -3
  257. package/dist/excalidraw/data/reconcile.js +18 -1
  258. package/dist/excalidraw/data/resave.d.ts +2 -2
  259. package/dist/excalidraw/data/restore.d.ts +3 -3
  260. package/dist/excalidraw/data/restore.js +58 -9
  261. package/dist/excalidraw/data/transform.d.ts +3 -3
  262. package/dist/excalidraw/data/transform.js +8 -5
  263. package/dist/excalidraw/data/types.d.ts +3 -3
  264. package/dist/excalidraw/element/ElementCanvasButtons.d.ts +1 -1
  265. package/dist/excalidraw/element/binding.d.ts +29 -10
  266. package/dist/excalidraw/element/binding.js +303 -71
  267. package/dist/excalidraw/element/bounds.d.ts +3 -3
  268. package/dist/excalidraw/element/collision.d.ts +4 -4
  269. package/dist/excalidraw/element/collision.js +5 -2
  270. package/dist/excalidraw/element/containerCache.d.ts +1 -1
  271. package/dist/excalidraw/element/dragElements.d.ts +6 -6
  272. package/dist/excalidraw/element/dragElements.js +39 -5
  273. package/dist/excalidraw/element/embeddable.d.ts +11 -6
  274. package/dist/excalidraw/element/heading.d.ts +11 -0
  275. package/dist/excalidraw/element/heading.js +81 -0
  276. package/dist/excalidraw/element/image.d.ts +2 -2
  277. package/dist/excalidraw/element/index.d.ts +2 -2
  278. package/dist/excalidraw/element/index.js +1 -1
  279. package/dist/excalidraw/element/linearElementEditor.d.ts +27 -16
  280. package/dist/excalidraw/element/linearElementEditor.js +133 -56
  281. package/dist/excalidraw/element/mutateElement.d.ts +3 -3
  282. package/dist/excalidraw/element/mutateElement.js +5 -3
  283. package/dist/excalidraw/element/newElement.d.ts +12 -10
  284. package/dist/excalidraw/element/newElement.js +31 -16
  285. package/dist/excalidraw/element/resizeElements.d.ts +15 -6
  286. package/dist/excalidraw/element/resizeElements.js +122 -46
  287. package/dist/excalidraw/element/resizeTest.d.ts +4 -4
  288. package/dist/excalidraw/element/resizeTest.js +2 -4
  289. package/dist/excalidraw/element/routing.d.ts +13 -0
  290. package/dist/excalidraw/element/routing.js +641 -0
  291. package/dist/excalidraw/element/showSelectedShapeActions.d.ts +2 -2
  292. package/dist/excalidraw/element/sizeHelpers.d.ts +2 -2
  293. package/dist/excalidraw/element/sortElements.d.ts +1 -1
  294. package/dist/excalidraw/element/textElement.d.ts +6 -28
  295. package/dist/excalidraw/element/textElement.js +64 -112
  296. package/dist/excalidraw/element/textWysiwyg.d.ts +12 -6
  297. package/dist/excalidraw/element/textWysiwyg.js +75 -62
  298. package/dist/excalidraw/element/transformHandles.d.ts +3 -3
  299. package/dist/excalidraw/element/transformHandles.js +7 -12
  300. package/dist/excalidraw/element/typeChecks.d.ts +7 -4
  301. package/dist/excalidraw/element/typeChecks.js +17 -0
  302. package/dist/excalidraw/element/types.d.ts +22 -4
  303. package/dist/excalidraw/emitter.d.ts +1 -1
  304. package/dist/excalidraw/fonts/ExcalidrawFont.d.ts +21 -0
  305. package/dist/excalidraw/fonts/ExcalidrawFont.js +112 -0
  306. package/dist/excalidraw/fonts/index.d.ts +58 -0
  307. package/dist/excalidraw/fonts/index.js +240 -0
  308. package/dist/excalidraw/fonts/metadata.d.ts +36 -0
  309. package/dist/excalidraw/fonts/metadata.js +91 -0
  310. package/dist/excalidraw/fractionalIndex.d.ts +12 -5
  311. package/dist/excalidraw/fractionalIndex.js +40 -10
  312. package/dist/excalidraw/frame.d.ts +4 -4
  313. package/dist/excalidraw/frame.js +3 -3
  314. package/dist/excalidraw/gatransforms.d.ts +1 -1
  315. package/dist/excalidraw/gesture.d.ts +1 -1
  316. package/dist/excalidraw/groups.d.ts +4 -4
  317. package/dist/excalidraw/history.d.ts +8 -7
  318. package/dist/excalidraw/history.js +8 -8
  319. package/dist/excalidraw/hooks/useEmitter.d.ts +1 -1
  320. package/dist/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  321. package/dist/excalidraw/i18n.d.ts +1 -1
  322. package/dist/excalidraw/index.d.ts +2 -2
  323. package/dist/excalidraw/index.js +3 -3
  324. package/dist/excalidraw/jotai.d.ts +1 -1
  325. package/dist/excalidraw/laser-trails.d.ts +3 -2
  326. package/dist/excalidraw/locales/en.json +42 -7
  327. package/dist/excalidraw/math.d.ts +47 -2
  328. package/dist/excalidraw/math.js +116 -0
  329. package/dist/excalidraw/mermaid.d.ts +2 -0
  330. package/dist/excalidraw/mermaid.js +29 -0
  331. package/dist/excalidraw/points.d.ts +1 -1
  332. package/dist/excalidraw/queue.d.ts +1 -1
  333. package/dist/excalidraw/renderer/helpers.d.ts +2 -2
  334. package/dist/excalidraw/renderer/interactiveScene.d.ts +2 -2
  335. package/dist/excalidraw/renderer/interactiveScene.js +64 -22
  336. package/dist/excalidraw/renderer/renderElement.d.ts +6 -4
  337. package/dist/excalidraw/renderer/renderElement.js +78 -58
  338. package/dist/excalidraw/renderer/renderSnaps.d.ts +1 -1
  339. package/dist/excalidraw/renderer/staticScene.d.ts +1 -1
  340. package/dist/excalidraw/renderer/staticSvgScene.d.ts +4 -4
  341. package/dist/excalidraw/renderer/staticSvgScene.js +2 -1
  342. package/dist/excalidraw/scene/Renderer.d.ts +4 -4
  343. package/dist/excalidraw/scene/Renderer.js +2 -3
  344. package/dist/excalidraw/scene/Scene.d.ts +16 -7
  345. package/dist/excalidraw/scene/Scene.js +26 -11
  346. package/dist/excalidraw/scene/Shape.d.ts +1 -1
  347. package/dist/excalidraw/scene/Shape.js +56 -5
  348. package/dist/excalidraw/scene/ShapeCache.d.ts +4 -4
  349. package/dist/excalidraw/scene/comparisons.d.ts +3 -2
  350. package/dist/excalidraw/scene/comparisons.js +1 -1
  351. package/dist/excalidraw/scene/export.d.ts +4 -3
  352. package/dist/excalidraw/scene/export.js +34 -36
  353. package/dist/excalidraw/scene/scroll.d.ts +2 -2
  354. package/dist/excalidraw/scene/scrollbars.d.ts +3 -3
  355. package/dist/excalidraw/scene/selection.d.ts +2 -2
  356. package/dist/excalidraw/scene/types.d.ts +6 -8
  357. package/dist/excalidraw/scene/zoom.d.ts +1 -1
  358. package/dist/excalidraw/shapes.d.ts +8 -0
  359. package/dist/excalidraw/shapes.js +57 -0
  360. package/dist/excalidraw/snapping.d.ts +4 -4
  361. package/dist/excalidraw/snapping.js +2 -1
  362. package/dist/excalidraw/store.d.ts +34 -4
  363. package/dist/excalidraw/store.js +27 -0
  364. package/dist/excalidraw/types.d.ts +32 -21
  365. package/dist/excalidraw/utils.d.ts +15 -5
  366. package/dist/excalidraw/utils.js +22 -0
  367. package/dist/excalidraw/zindex.d.ts +2 -2
  368. package/dist/prod/CascadiaCode-Regular-TMZI7IJ5.woff2 +0 -0
  369. package/dist/prod/ComicShanns-Regular-6TOETDFT.woff2 +0 -0
  370. package/dist/prod/Excalifont-Regular-CPKEUDVM.woff2 +0 -0
  371. package/dist/prod/LiberationSans-Regular-ZQD73GJM.woff2 +0 -0
  372. package/dist/prod/Virgil-Regular-YHAB2VGJ.woff2 +0 -0
  373. package/dist/prod/{en-XW4JO6VX.json → en-YNVBSAIL.json} +42 -7
  374. package/dist/prod/index.css +1 -1
  375. package/dist/prod/index.js +49 -53
  376. package/dist/utils/bbox.d.ts +2 -2
  377. package/dist/utils/collision.d.ts +1 -1
  378. package/dist/utils/export.d.ts +4 -3
  379. package/dist/utils/export.js +2 -1
  380. package/dist/utils/geometry/geometry.d.ts +3 -2
  381. package/dist/utils/geometry/geometry.js +5 -1
  382. package/dist/utils/geometry/shape.d.ts +1 -1
  383. package/dist/utils/index.d.ts +1 -0
  384. package/dist/utils/index.js +1 -0
  385. package/dist/utils/withinBounds.d.ts +1 -1
  386. package/history.ts +13 -6
  387. package/package.json +2 -2
  388. package/dist/browser/dev/Cascadia-CYPE3OJC.woff2 +0 -0
  389. package/dist/browser/dev/Virgil-UZN6MUT6.woff2 +0 -0
  390. package/dist/browser/dev/excalidraw-assets-dev/chunk-BLEB3M62.js.map +0 -7
  391. package/dist/browser/dev/excalidraw-assets-dev/chunk-XOM7LNOU.js.map +0 -7
  392. package/dist/browser/dev/excalidraw-assets-dev/dist-ITJNUBZF.js.map +0 -7
  393. package/dist/browser/prod/Cascadia-CYPE3OJC.woff2 +0 -0
  394. package/dist/browser/prod/Virgil-UZN6MUT6.woff2 +0 -0
  395. package/dist/browser/prod/excalidraw-assets/chunk-UWBW5SR2.js +0 -55
  396. package/dist/browser/prod/excalidraw-assets/dist-54276HPL.js +0 -6
  397. package/dist/browser/prod/excalidraw-assets/en-7GPZE2Y2.js +0 -1
  398. package/dist/browser/prod/excalidraw-assets/image-35KQQ5EN.js +0 -1
  399. package/dist/dev/Cascadia-CYPE3OJC.woff2 +0 -0
  400. package/dist/dev/Virgil-UZN6MUT6.woff2 +0 -0
  401. package/dist/excalidraw/components/Stats.d.ts +0 -11
  402. package/dist/excalidraw/components/Stats.js +0 -13
  403. package/dist/excalidraw/scene/Fonts.d.ts +0 -21
  404. package/dist/excalidraw/scene/Fonts.js +0 -72
  405. package/dist/prod/Cascadia-CYPE3OJC.woff2 +0 -0
  406. package/dist/prod/Virgil-UZN6MUT6.woff2 +0 -0
  407. /package/dist/browser/dev/{Assistant-Bold-ZDZZ6JHA.woff2 → excalidraw-assets-dev/Assistant-Bold-ZDZZ6JHA.woff2} +0 -0
  408. /package/dist/browser/dev/{Assistant-Medium-DZ25RZU3.woff2 → excalidraw-assets-dev/Assistant-Medium-DZ25RZU3.woff2} +0 -0
  409. /package/dist/browser/dev/{Assistant-Regular-PLF2XOGW.woff2 → excalidraw-assets-dev/Assistant-Regular-PLF2XOGW.woff2} +0 -0
  410. /package/dist/browser/dev/{Assistant-SemiBold-CZ5MX6FK.woff2 → excalidraw-assets-dev/Assistant-SemiBold-CZ5MX6FK.woff2} +0 -0
  411. /package/dist/browser/dev/excalidraw-assets-dev/{en-TR4QLF5E.js.map → en-XV7OZCPP.js.map} +0 -0
  412. /package/dist/browser/dev/excalidraw-assets-dev/{image-ZGDDRBEN.js.map → image-77HZYGLG.js.map} +0 -0
  413. /package/dist/browser/prod/{Assistant-Bold-ZDZZ6JHA.woff2 → excalidraw-assets/Assistant-Bold-ZDZZ6JHA.woff2} +0 -0
  414. /package/dist/browser/prod/{Assistant-Medium-DZ25RZU3.woff2 → excalidraw-assets/Assistant-Medium-DZ25RZU3.woff2} +0 -0
  415. /package/dist/browser/prod/{Assistant-Regular-PLF2XOGW.woff2 → excalidraw-assets/Assistant-Regular-PLF2XOGW.woff2} +0 -0
  416. /package/dist/browser/prod/{Assistant-SemiBold-CZ5MX6FK.woff2 → excalidraw-assets/Assistant-SemiBold-CZ5MX6FK.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import type { Drawable, Options } from "roughjs/bin/core";
2
2
  import type { RoughGenerator } from "roughjs/bin/generator";
3
3
  import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "../element/types";
4
- import { EmbedsValidationStatus } from "../types";
4
+ import type { EmbedsValidationStatus } from "../types";
5
5
  export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
6
6
  /**
7
7
  * Generates the roughjs shape for given element.
@@ -1,10 +1,10 @@
1
1
  import { getDiamondPoints, getArrowheadPoints } from "../element";
2
- import { isPathALoop, getCornerRadius } from "../math";
2
+ import { isPathALoop, getCornerRadius, distanceSq2d } from "../math";
3
3
  import { generateFreeDrawShape } from "../renderer/renderElement";
4
4
  import { isTransparent, assertNever } from "../utils";
5
5
  import { simplify } from "points-on-curve";
6
6
  import { ROUGHNESS } from "../constants";
7
- import { isEmbeddableElement, isIframeElement, isIframeLikeElement, isLinearElement, } from "../element/typeChecks";
7
+ import { isElbowArrow, isEmbeddableElement, isIframeElement, isIframeLikeElement, isLinearElement, } from "../element/typeChecks";
8
8
  import { canChangeRoundness } from "./comparisons";
9
9
  const getDashArrayDashed = (strokeWidth) => [8, 8 + strokeWidth];
10
10
  const getDashArrayDotted = (strokeWidth) => [1.5, 6 + strokeWidth];
@@ -261,9 +261,14 @@ export const _generateElementShape = (element, generator, { isExporting, canvasB
261
261
  // points array can be empty in the beginning, so it is important to add
262
262
  // initial position to it
263
263
  const points = element.points.length ? element.points : [[0, 0]];
264
- // curve is always the first element
265
- // this simplifies finding the curve for an element
266
- if (!element.roundness) {
264
+ if (isElbowArrow(element)) {
265
+ shape = [
266
+ generator.path(generateElbowArrowShape(points, 16), generateRoughOptions(element, true)),
267
+ ];
268
+ }
269
+ else if (!element.roundness) {
270
+ // curve is always the first element
271
+ // this simplifies finding the curve for an element
267
272
  if (options.fill) {
268
273
  shape = [generator.polygon(points, options)];
269
274
  }
@@ -322,3 +327,49 @@ export const _generateElementShape = (element, generator, { isExporting, canvasB
322
327
  }
323
328
  }
324
329
  };
330
+ const generateElbowArrowShape = (points, radius) => {
331
+ const subpoints = [];
332
+ for (let i = 1; i < points.length - 1; i += 1) {
333
+ const prev = points[i - 1];
334
+ const next = points[i + 1];
335
+ const corner = Math.min(radius, Math.sqrt(distanceSq2d(points[i], next)) / 2, Math.sqrt(distanceSq2d(points[i], prev)) / 2);
336
+ if (prev[0] < points[i][0] && prev[1] === points[i][1]) {
337
+ // LEFT
338
+ subpoints.push([points[i][0] - corner, points[i][1]]);
339
+ }
340
+ else if (prev[0] === points[i][0] && prev[1] < points[i][1]) {
341
+ // UP
342
+ subpoints.push([points[i][0], points[i][1] - corner]);
343
+ }
344
+ else if (prev[0] > points[i][0] && prev[1] === points[i][1]) {
345
+ // RIGHT
346
+ subpoints.push([points[i][0] + corner, points[i][1]]);
347
+ }
348
+ else {
349
+ subpoints.push([points[i][0], points[i][1] + corner]);
350
+ }
351
+ subpoints.push(points[i]);
352
+ if (next[0] < points[i][0] && next[1] === points[i][1]) {
353
+ // LEFT
354
+ subpoints.push([points[i][0] - corner, points[i][1]]);
355
+ }
356
+ else if (next[0] === points[i][0] && next[1] < points[i][1]) {
357
+ // UP
358
+ subpoints.push([points[i][0], points[i][1] - corner]);
359
+ }
360
+ else if (next[0] > points[i][0] && next[1] === points[i][1]) {
361
+ // RIGHT
362
+ subpoints.push([points[i][0] + corner, points[i][1]]);
363
+ }
364
+ else {
365
+ subpoints.push([points[i][0], points[i][1] + corner]);
366
+ }
367
+ }
368
+ const d = [`M ${points[0][0]} ${points[0][1]}`];
369
+ for (let i = 0; i < subpoints.length; i += 3) {
370
+ d.push(`L ${subpoints[i][0]} ${subpoints[i][1]}`);
371
+ d.push(`Q ${subpoints[i + 1][0]} ${subpoints[i + 1][1]}, ${subpoints[i + 2][0]} ${subpoints[i + 2][1]}`);
372
+ }
373
+ d.push(`L ${points[points.length - 1][0]} ${points[points.length - 1][1]}`);
374
+ return d.join(" ");
375
+ };
@@ -1,7 +1,7 @@
1
- import { Drawable } from "roughjs/bin/core";
2
- import { ExcalidrawElement } from "../element/types";
3
- import { ElementShape, ElementShapes } from "./types";
4
- import { AppState, EmbedsValidationStatus } from "../types";
1
+ import type { Drawable } from "roughjs/bin/core";
2
+ import type { ExcalidrawElement } from "../element/types";
3
+ import type { ElementShape, ElementShapes } from "./types";
4
+ import type { AppState, EmbedsValidationStatus } from "../types";
5
5
  export declare class ShapeCache {
6
6
  private static rg;
7
7
  private static cache;
@@ -1,10 +1,11 @@
1
- import { NonDeletedExcalidrawElement } from "../element/types";
2
- import { ElementOrToolType } from "../types";
1
+ import type { NonDeletedExcalidrawElement } from "../element/types";
2
+ import type { ElementOrToolType } from "../types";
3
3
  export declare const hasBackground: (type: ElementOrToolType) => boolean;
4
4
  export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
5
5
  export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
6
6
  export declare const hasStrokeStyle: (type: ElementOrToolType) => boolean;
7
7
  export declare const canChangeRoundness: (type: ElementOrToolType) => boolean;
8
+ export declare const toolIsArrow: (type: ElementOrToolType) => boolean;
8
9
  export declare const canHaveArrowheads: (type: ElementOrToolType) => boolean;
9
10
  export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
10
11
  export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
@@ -25,10 +25,10 @@ export const hasStrokeStyle = (type) => type === "rectangle" ||
25
25
  export const canChangeRoundness = (type) => type === "rectangle" ||
26
26
  type === "iframe" ||
27
27
  type === "embeddable" ||
28
- type === "arrow" ||
29
28
  type === "line" ||
30
29
  type === "diamond" ||
31
30
  type === "image";
31
+ export const toolIsArrow = (type) => type === "arrow";
32
32
  export const canHaveArrowheads = (type) => type === "arrow";
33
33
  export const getElementAtPosition = (elements, isAtPositionFn) => {
34
34
  let hitElement = null;
@@ -1,5 +1,5 @@
1
- import { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
2
- import { AppState, BinaryFiles } from "../types";
1
+ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
2
+ import type { AppState, BinaryFiles } from "../types";
3
3
  export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, exportingFrame, }: {
4
4
  exportBackground: boolean;
5
5
  exportPadding?: number | undefined;
@@ -8,7 +8,7 @@ export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawEle
8
8
  }, createCanvas?: (width: number, height: number) => {
9
9
  canvas: HTMLCanvasElement;
10
10
  scale: number;
11
- }) => Promise<HTMLCanvasElement>;
11
+ }, loadFonts?: () => Promise<void>) => Promise<HTMLCanvasElement>;
12
12
  export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElement[], appState: {
13
13
  exportBackground: boolean;
14
14
  exportPadding?: number;
@@ -23,5 +23,6 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
23
23
  */
24
24
  renderEmbeddables?: boolean;
25
25
  exportingFrame?: ExcalidrawFrameLikeElement | null;
26
+ skipInliningFonts?: true;
26
27
  }) => Promise<SVGSVGElement>;
27
28
  export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
@@ -1,17 +1,18 @@
1
1
  import rough from "roughjs/bin/rough";
2
- import { getCommonBounds, getElementAbsoluteCoords, } from "../element/bounds";
2
+ import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
3
3
  import { renderSceneToSvg } from "../renderer/staticSvgScene";
4
4
  import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
5
- import { DEFAULT_EXPORT_PADDING, FONT_FAMILY, FRAME_STYLE, SVG_NS, THEME, THEME_FILTER, } from "../constants";
5
+ import { DEFAULT_EXPORT_PADDING, FRAME_STYLE, FONT_FAMILY, SVG_NS, THEME, THEME_FILTER, } from "../constants";
6
6
  import { getDefaultAppState } from "../appState";
7
7
  import { serializeAsJSON } from "../data/json";
8
8
  import { getInitializedImageElements, updateImageCache, } from "../element/image";
9
9
  import { getElementsOverlappingFrame, getFrameLikeElements, getFrameLikeTitle, getRootElements, } from "../frame";
10
10
  import { newTextElement } from "../element";
11
11
  import { newElementWith } from "../element/mutateElement";
12
- import { isFrameElement, isFrameLikeElement } from "../element/typeChecks";
12
+ import { isFrameLikeElement, isTextElement } from "../element/typeChecks";
13
13
  import { syncInvalidIndices } from "../fractionalIndex";
14
14
  import { renderStaticScene } from "../renderer/staticScene";
15
+ import { Fonts } from "../fonts";
15
16
  const SVG_EXPORT_TAG = `<!-- svg-source:excalidraw -->`;
16
17
  const truncateText = (element, maxWidth) => {
17
18
  if (element.width <= maxWidth) {
@@ -48,26 +49,18 @@ const truncateText = (element, maxWidth) => {
48
49
  */
49
50
  const addFrameLabelsAsTextElements = (elements, opts) => {
50
51
  const nextElements = [];
51
- let frameIndex = 0;
52
- let magicFrameIndex = 0;
53
52
  for (const element of elements) {
54
53
  if (isFrameLikeElement(element)) {
55
- if (isFrameElement(element)) {
56
- frameIndex++;
57
- }
58
- else {
59
- magicFrameIndex++;
60
- }
61
54
  let textElement = newTextElement({
62
55
  x: element.x,
63
56
  y: element.y - FRAME_STYLE.nameOffsetY,
64
- fontFamily: FONT_FAMILY.Assistant,
57
+ fontFamily: FONT_FAMILY.Helvetica,
65
58
  fontSize: FRAME_STYLE.nameFontSize,
66
59
  lineHeight: FRAME_STYLE.nameLineHeight,
67
60
  strokeColor: opts.exportWithDarkMode
68
61
  ? FRAME_STYLE.nameColorDarkTheme
69
62
  : FRAME_STYLE.nameColorLightTheme,
70
- text: getFrameLikeTitle(element, isFrameElement(element) ? frameIndex : magicFrameIndex),
63
+ text: getFrameLikeTitle(element),
71
64
  });
72
65
  textElement.y -= textElement.height;
73
66
  textElement = truncateText(textElement, element.width);
@@ -106,7 +99,11 @@ export const exportToCanvas = async (elements, appState, files, { exportBackgrou
106
99
  canvas.width = width * appState.exportScale;
107
100
  canvas.height = height * appState.exportScale;
108
101
  return { canvas, scale: appState.exportScale };
102
+ }, loadFonts = async () => {
103
+ await Fonts.loadFontsForElements(elements);
109
104
  }) => {
105
+ // load font faces before continuing, by default leverages browsers' [FontFace API](https://developer.mozilla.org/en-US/docs/Web/API/FontFace)
106
+ await loadFonts();
110
107
  const frameRendering = getFrameRenderingConfig(exportingFrame ?? null, appState.frameRendering ?? null);
111
108
  const elementsForRender = prepareElementsForRender({
112
109
  elements,
@@ -195,17 +192,6 @@ export const exportToSvg = async (elements, appState, files, opts) => {
195
192
  if (exportWithDarkMode) {
196
193
  svgRoot.setAttribute("filter", THEME_FILTER);
197
194
  }
198
- let assetPath = "https://excalidraw.com/";
199
- // Asset path needs to be determined only when using package
200
- if (import.meta.env.VITE_IS_EXCALIDRAW_NPM_PACKAGE) {
201
- assetPath =
202
- window.EXCALIDRAW_ASSET_PATH ||
203
- `https://unpkg.com/${import.meta.env.VITE_PKG_NAME}@${import.meta.env.PKG_VERSION}`;
204
- if (assetPath?.startsWith("/")) {
205
- assetPath = assetPath.replace("/", `${window.location.origin}/`);
206
- }
207
- assetPath = `${assetPath}/dist/excalidraw-assets/`;
208
- }
209
195
  const offsetX = -minX + exportPadding;
210
196
  const offsetY = -minY + exportPadding;
211
197
  const frameElements = getFrameLikeElements(elements);
@@ -223,23 +209,35 @@ export const exportToSvg = async (elements, appState, files, opts) => {
223
209
  </rect>
224
210
  </clipPath>`;
225
211
  }
212
+ const fontFamilies = elements.reduce((acc, element) => {
213
+ if (isTextElement(element)) {
214
+ acc.add(element.fontFamily);
215
+ }
216
+ return acc;
217
+ }, new Set());
218
+ const fontFaces = opts?.skipInliningFonts
219
+ ? []
220
+ : await Promise.all(Array.from(fontFamilies).map(async (x) => {
221
+ const { fonts, metadata } = Fonts.registered.get(x) ?? {};
222
+ if (!Array.isArray(fonts)) {
223
+ console.error(`Couldn't find registered fonts for font-family "${x}"`, Fonts.registered);
224
+ return;
225
+ }
226
+ if (metadata?.local) {
227
+ // don't inline local fonts
228
+ return;
229
+ }
230
+ return Promise.all(fonts.map(async (font) => `@font-face {
231
+ font-family: ${font.fontFace.family};
232
+ src: url(${await font.getContent()});
233
+ }`));
234
+ }));
226
235
  svgRoot.innerHTML = `
227
236
  ${SVG_EXPORT_TAG}
228
237
  ${metadata}
229
238
  <defs>
230
239
  <style class="style-fonts">
231
- @font-face {
232
- font-family: "Virgil";
233
- src: url("${assetPath}Virgil.woff2");
234
- }
235
- @font-face {
236
- font-family: "Cascadia";
237
- src: url("${assetPath}Cascadia.woff2");
238
- }
239
- @font-face {
240
- font-family: "Assistant";
241
- src: url("${assetPath}Assistant-Regular.woff2");
242
- }
240
+ ${fontFaces.flat().filter(Boolean).join("\n")}
243
241
  </style>
244
242
  ${exportingFrameClipPath}
245
243
  </defs>
@@ -1,5 +1,5 @@
1
- import { AppState, PointerCoords, Zoom } from "../types";
2
- import { ExcalidrawElement } from "../element/types";
1
+ import type { AppState, PointerCoords, Zoom } from "../types";
2
+ import type { ExcalidrawElement } from "../element/types";
3
3
  export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, }: {
4
4
  scenePoint: PointerCoords;
5
5
  viewportDimensions: {
@@ -1,6 +1,6 @@
1
- import { InteractiveCanvasAppState } from "../types";
2
- import { ScrollBars } from "./types";
3
- import { ExcalidrawElement } from "../element/types";
1
+ import type { InteractiveCanvasAppState } from "../types";
2
+ import type { ScrollBars } from "./types";
3
+ import type { ExcalidrawElement } from "../element/types";
4
4
  export declare const SCROLLBAR_MARGIN = 4;
5
5
  export declare const SCROLLBAR_WIDTH = 6;
6
6
  export declare const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
@@ -1,5 +1,5 @@
1
- import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
2
- import { AppState, InteractiveCanvasAppState } from "../types";
1
+ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
2
+ import type { AppState, InteractiveCanvasAppState } from "../types";
3
3
  /**
4
4
  * Frames and their containing elements are not to be selected at the same time.
5
5
  * Given an array of selected elements, if there are frames and their containing elements
@@ -1,8 +1,8 @@
1
1
  import type { RoughCanvas } from "roughjs/bin/canvas";
2
- import { Drawable } from "roughjs/bin/core";
3
- import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../element/types";
4
- import { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, UserIdleState, Device } from "../types";
5
- import { MakeBrand } from "../utility-types";
2
+ import type { Drawable } from "roughjs/bin/core";
3
+ import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../element/types";
4
+ import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, UserIdleState, Device } from "../types";
5
+ import type { MakeBrand } from "../utility-types";
6
6
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
7
7
  export type StaticCanvasRenderConfig = {
8
8
  canvasBackgroundColor: AppState["viewBackgroundColor"];
@@ -33,7 +33,7 @@ export type InteractiveCanvasRenderConfig = {
33
33
  remotePointerUserStates: Map<SocketId, UserIdleState>;
34
34
  remotePointerUsernames: Map<SocketId, string>;
35
35
  remotePointerButton: Map<SocketId, string | undefined>;
36
- selectionColor?: string;
36
+ selectionColor: string;
37
37
  renderScrollbars?: boolean;
38
38
  };
39
39
  export type RenderInteractiveSceneCallback = {
@@ -56,6 +56,7 @@ export type InteractiveSceneRenderConfig = {
56
56
  elementsMap: RenderableElementsMap;
57
57
  visibleElements: readonly NonDeletedExcalidrawElement[];
58
58
  selectedElements: readonly NonDeletedExcalidrawElement[];
59
+ allElementsMap: NonDeletedSceneElementsMap;
59
60
  scale: number;
60
61
  appState: InteractiveCanvasAppState;
61
62
  renderConfig: InteractiveCanvasRenderConfig;
@@ -66,9 +67,6 @@ export type SceneScroll = {
66
67
  scrollX: number;
67
68
  scrollY: number;
68
69
  };
69
- export interface Scene {
70
- elements: ExcalidrawTextElement[];
71
- }
72
70
  export type ExportType = "png" | "clipboard" | "clipboard-svg" | "backend" | "svg";
73
71
  export type ScrollBars = {
74
72
  horizontal: {
@@ -1,4 +1,4 @@
1
- import { AppState, NormalizedZoomValue } from "../types";
1
+ import type { AppState, NormalizedZoomValue } from "../types";
2
2
  export declare const getNormalizedZoom: (zoom: number) => NormalizedZoomValue;
3
3
  export declare const getStateForZoom: ({ viewportX, viewportY, nextZoom, }: {
4
4
  viewportX: number;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { type GeometricShape } from "../utils/geometry/shape";
3
+ import type { ElementsMap, ExcalidrawElement } from "./element/types";
2
4
  export declare const SHAPES: readonly [{
3
5
  readonly icon: JSX.Element;
4
6
  readonly value: "selection";
@@ -61,3 +63,9 @@ export declare const SHAPES: readonly [{
61
63
  readonly fillable: false;
62
64
  }];
63
65
  export declare const findShapeByKey: (key: string) => "text" | "image" | "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "eraser" | null;
66
+ /**
67
+ * get the pure geometric shape of an excalidraw element
68
+ * which is then used for hit detection
69
+ */
70
+ export declare const getElementShape: (element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape;
71
+ export declare const getBoundTextShape: (element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape | null;
@@ -1,5 +1,11 @@
1
+ import { getClosedCurveShape, getCurveShape, getEllipseShape, getFreedrawShape, getPolygonShape, } from "../utils/geometry/shape";
1
2
  import { ArrowIcon, DiamondIcon, EllipseIcon, EraserIcon, FreedrawIcon, ImageIcon, LineIcon, RectangleIcon, SelectionIcon, TextIcon, } from "./components/icons";
3
+ import { getElementAbsoluteCoords } from "./element";
4
+ import { shouldTestInside } from "./element/collision";
5
+ import { LinearElementEditor } from "./element/linearElementEditor";
6
+ import { getBoundTextElement } from "./element/textElement";
2
7
  import { KEYS } from "./keys";
8
+ import { ShapeCache } from "./scene/ShapeCache";
3
9
  export const SHAPES = [
4
10
  {
5
11
  icon: SelectionIcon,
@@ -82,3 +88,54 @@ export const findShapeByKey = (key) => {
82
88
  });
83
89
  return shape?.value || null;
84
90
  };
91
+ /**
92
+ * get the pure geometric shape of an excalidraw element
93
+ * which is then used for hit detection
94
+ */
95
+ export const getElementShape = (element, elementsMap) => {
96
+ switch (element.type) {
97
+ case "rectangle":
98
+ case "diamond":
99
+ case "frame":
100
+ case "magicframe":
101
+ case "embeddable":
102
+ case "image":
103
+ case "iframe":
104
+ case "text":
105
+ case "selection":
106
+ return getPolygonShape(element);
107
+ case "arrow":
108
+ case "line": {
109
+ const roughShape = ShapeCache.get(element)?.[0] ??
110
+ ShapeCache.generateElementShape(element, null)[0];
111
+ const [, , , , cx, cy] = getElementAbsoluteCoords(element, elementsMap);
112
+ return shouldTestInside(element)
113
+ ? getClosedCurveShape(element, roughShape, [element.x, element.y], element.angle, [cx, cy])
114
+ : getCurveShape(roughShape, [element.x, element.y], element.angle, [
115
+ cx,
116
+ cy,
117
+ ]);
118
+ }
119
+ case "ellipse":
120
+ return getEllipseShape(element);
121
+ case "freedraw": {
122
+ const [, , , , cx, cy] = getElementAbsoluteCoords(element, elementsMap);
123
+ return getFreedrawShape(element, [cx, cy], shouldTestInside(element));
124
+ }
125
+ }
126
+ };
127
+ export const getBoundTextShape = (element, elementsMap) => {
128
+ const boundTextElement = getBoundTextElement(element, elementsMap);
129
+ if (boundTextElement) {
130
+ if (element.type === "arrow") {
131
+ return getElementShape({
132
+ ...boundTextElement,
133
+ // arrow's bound text accurate position is not stored in the element's property
134
+ // but rather calculated and returned from the following static method
135
+ ...LinearElementEditor.getBoundTextElementPosition(element, boundTextElement, elementsMap),
136
+ }, elementsMap);
137
+ }
138
+ return getElementShape(boundTextElement, elementsMap);
139
+ }
140
+ return null;
141
+ };
@@ -1,7 +1,7 @@
1
- import { Bounds } from "./element/bounds";
2
- import { MaybeTransformHandleType } from "./element/transformHandles";
3
- import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
4
- import { AppState, KeyboardModifiersObject, Point } from "./types";
1
+ import type { Bounds } from "./element/bounds";
2
+ import type { MaybeTransformHandleType } from "./element/transformHandles";
3
+ import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
4
+ import type { AppState, KeyboardModifiersObject, Point } from "./types";
5
5
  export declare const getSnapDistance: (zoomValue: number) => number;
6
6
  type Vector2D = {
7
7
  x: number;
@@ -835,5 +835,6 @@ export const isActiveToolNonLinearSnappable = (activeToolType) => {
835
835
  activeToolType === TOOL_TYPE.diamond ||
836
836
  activeToolType === TOOL_TYPE.frame ||
837
837
  activeToolType === TOOL_TYPE.magicframe ||
838
- activeToolType === TOOL_TYPE.image);
838
+ activeToolType === TOOL_TYPE.image ||
839
+ activeToolType === TOOL_TYPE.text);
839
840
  };
@@ -1,12 +1,42 @@
1
1
  import { AppStateChange, ElementsChange } from "./change";
2
- import { OrderedExcalidrawElement } from "./element/types";
2
+ import type { OrderedExcalidrawElement } from "./element/types";
3
3
  import { Emitter } from "./emitter";
4
- import { AppState, ObservedAppState } from "./types";
4
+ import type { AppState, ObservedAppState } from "./types";
5
+ import type { ValueOf } from "./utility-types";
5
6
  export declare const getObservedAppState: (appState: AppState) => ObservedAppState;
6
- export type StoreActionType = "capture" | "update" | "none";
7
7
  export declare const StoreAction: {
8
- [K in Uppercase<StoreActionType>]: StoreActionType;
8
+ /**
9
+ * Immediately undoable.
10
+ *
11
+ * Use for updates which should be captured.
12
+ * Should be used for most of the local updates.
13
+ *
14
+ * These updates will _immediately_ make it to the local undo / redo stacks.
15
+ */
16
+ readonly CAPTURE: "capture";
17
+ /**
18
+ * Never undoable.
19
+ *
20
+ * Use for updates which should never be recorded, such as remote updates
21
+ * or scene initialization.
22
+ *
23
+ * These updates will _never_ make it to the local undo / redo stacks.
24
+ */
25
+ readonly UPDATE: "update";
26
+ /**
27
+ * Eventually undoable.
28
+ *
29
+ * Use for updates which should not be captured immediately - likely
30
+ * exceptions which are part of some async multi-step process. Otherwise, all
31
+ * such updates would end up being captured with the next
32
+ * `StoreAction.CAPTURE` - triggered either by the next `updateScene`
33
+ * or internally by the editor.
34
+ *
35
+ * These updates will _eventually_ make it to the local undo / redo stacks.
36
+ */
37
+ readonly NONE: "none";
9
38
  };
39
+ export type StoreActionType = ValueOf<typeof StoreAction>;
10
40
  /**
11
41
  * Represent an increment to the Store.
12
42
  */
@@ -25,8 +25,35 @@ export const getObservedAppState = (appState) => {
25
25
  };
26
26
  const isObservedAppState = (appState) => !!Reflect.get(appState, hiddenObservedAppStateProp);
27
27
  export const StoreAction = {
28
+ /**
29
+ * Immediately undoable.
30
+ *
31
+ * Use for updates which should be captured.
32
+ * Should be used for most of the local updates.
33
+ *
34
+ * These updates will _immediately_ make it to the local undo / redo stacks.
35
+ */
28
36
  CAPTURE: "capture",
37
+ /**
38
+ * Never undoable.
39
+ *
40
+ * Use for updates which should never be recorded, such as remote updates
41
+ * or scene initialization.
42
+ *
43
+ * These updates will _never_ make it to the local undo / redo stacks.
44
+ */
29
45
  UPDATE: "update",
46
+ /**
47
+ * Eventually undoable.
48
+ *
49
+ * Use for updates which should not be captured immediately - likely
50
+ * exceptions which are part of some async multi-step process. Otherwise, all
51
+ * such updates would end up being captured with the next
52
+ * `StoreAction.CAPTURE` - triggered either by the next `updateScene`
53
+ * or internally by the editor.
54
+ *
55
+ * These updates will _eventually_ make it to the local undo / redo stacks.
56
+ */
30
57
  NONE: "none",
31
58
  };
32
59
  /**