@excalidraw/element 0.18.0-042a6979d → 0.18.0-063e025

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 (308) hide show
  1. package/dist/dev/index.js +7295 -4299
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +20 -19
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/appEventBus.d.ts +27 -0
  6. package/dist/types/common/src/bounds.d.ts +10 -0
  7. package/dist/types/common/src/colors.d.ts +59 -39
  8. package/dist/types/common/src/constants.d.ts +46 -33
  9. package/dist/types/common/src/editorInterface.d.ts +34 -0
  10. package/dist/types/common/src/font-metadata.d.ts +1 -3
  11. package/dist/types/common/src/index.d.ts +5 -0
  12. package/dist/types/common/src/keys.d.ts +1 -1
  13. package/dist/types/common/src/utility-types.d.ts +0 -1
  14. package/dist/types/common/src/utils.d.ts +46 -76
  15. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  16. package/dist/types/element/src/Scene.d.ts +11 -7
  17. package/dist/types/element/src/align.d.ts +2 -2
  18. package/dist/types/element/src/arrowheads.d.ts +3 -0
  19. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  20. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  21. package/dist/types/element/src/binding.d.ts +69 -50
  22. package/dist/types/element/src/bounds.d.ts +26 -19
  23. package/dist/types/element/src/collision.d.ts +7 -2
  24. package/dist/types/element/src/comparisons.d.ts +8 -7
  25. package/dist/types/element/src/delta.d.ts +0 -1
  26. package/dist/types/element/src/distribute.d.ts +3 -2
  27. package/dist/types/element/src/dragElements.d.ts +3 -3
  28. package/dist/types/element/src/duplicate.d.ts +7 -6
  29. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  30. package/dist/types/element/src/embeddable.d.ts +2 -2
  31. package/dist/types/element/src/flowchart.d.ts +3 -3
  32. package/dist/types/element/src/fractionalIndex.d.ts +4 -4
  33. package/dist/types/element/src/frame.d.ts +14 -9
  34. package/dist/types/element/src/groups.d.ts +9 -9
  35. package/dist/types/element/src/heading.d.ts +2 -1
  36. package/dist/types/element/src/image.d.ts +1 -11
  37. package/dist/types/element/src/index.d.ts +6 -4
  38. package/dist/types/element/src/linearElementEditor.d.ts +31 -30
  39. package/dist/types/element/src/mutateElement.d.ts +5 -1
  40. package/dist/types/element/src/newElement.d.ts +7 -6
  41. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  42. package/dist/types/element/src/renderElement.d.ts +4 -10
  43. package/dist/types/element/src/resizeElements.d.ts +12 -12
  44. package/dist/types/element/src/resizeTest.d.ts +6 -5
  45. package/dist/types/element/src/selection.d.ts +14 -14
  46. package/dist/types/element/src/shape.d.ts +9 -8
  47. package/dist/types/element/src/textElement.d.ts +9 -9
  48. package/dist/types/element/src/textMeasurements.d.ts +1 -3
  49. package/dist/types/element/src/textWrapping.d.ts +26 -0
  50. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
  51. package/dist/types/element/src/transformHandles.d.ts +8 -27
  52. package/dist/types/element/src/typeChecks.d.ts +29 -31
  53. package/dist/types/element/src/types.d.ts +20 -14
  54. package/dist/types/element/src/utils.d.ts +9 -4
  55. package/dist/types/element/src/visualdebug.d.ts +58 -0
  56. package/dist/types/element/src/zindex.d.ts +7 -1
  57. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +143 -177
  58. package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
  59. package/dist/types/excalidraw/actions/actionBoundText.d.ts +102 -125
  60. package/dist/types/excalidraw/actions/actionCanvas.d.ts +522 -1194
  61. package/dist/types/excalidraw/actions/actionClipboard.d.ts +104 -868
  62. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +49 -61
  63. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +164 -202
  64. package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
  65. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
  66. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
  67. package/dist/types/excalidraw/actions/actionElementLink.d.ts +41 -59
  68. package/dist/types/excalidraw/actions/actionElementLock.d.ts +101 -124
  69. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +50 -62
  70. package/dist/types/excalidraw/actions/actionExport.d.ts +179 -1407
  71. package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -394
  72. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  73. package/dist/types/excalidraw/actions/actionFrame.d.ts +304 -386
  74. package/dist/types/excalidraw/actions/actionGroup.d.ts +112 -143
  75. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +162 -211
  76. package/dist/types/excalidraw/actions/actionLink.d.ts +48 -60
  77. package/dist/types/excalidraw/actions/actionMenu.d.ts +40 -424
  78. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -359
  79. package/dist/types/excalidraw/actions/actionProperties.d.ts +181 -2525
  80. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +56 -72
  81. package/dist/types/excalidraw/actions/actionStyles.d.ts +49 -60
  82. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  83. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
  84. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +53 -66
  85. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
  86. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +50 -62
  87. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +41 -60
  88. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
  89. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +50 -62
  90. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +50 -62
  91. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +51 -63
  92. package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -3
  93. package/dist/types/excalidraw/actions/index.d.ts +5 -2
  94. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  95. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  96. package/dist/types/excalidraw/actions/types.d.ts +7 -7
  97. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  98. package/dist/types/excalidraw/appState.d.ts +24 -15
  99. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  100. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  101. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  102. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  103. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  104. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  105. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  106. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  107. package/dist/types/excalidraw/clipboard.d.ts +57 -19
  108. package/dist/types/excalidraw/components/Actions.d.ts +23 -7
  109. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  110. package/dist/types/excalidraw/components/App.d.ts +179 -100
  111. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  112. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  113. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  114. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -3
  115. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  116. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  117. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  118. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
  119. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
  120. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  121. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  122. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  123. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -4
  124. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  125. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  126. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  127. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  128. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  129. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  130. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
  131. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  132. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  133. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  134. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  135. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  136. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  137. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  138. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  139. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  140. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  141. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  142. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  143. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  144. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  145. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
  146. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  147. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  148. package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  149. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  150. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  151. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  152. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  153. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  154. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
  155. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  156. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  157. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  158. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  159. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  160. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  161. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
  162. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  163. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  164. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  165. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  166. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  167. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  168. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  169. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  170. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  171. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  172. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
  173. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  174. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  175. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  176. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  177. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  178. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  179. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  180. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  181. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  182. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  183. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  184. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  185. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  186. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
  187. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  188. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  189. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  190. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  191. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  192. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  193. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  194. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  195. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  196. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  197. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  198. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
  199. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  200. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  201. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  202. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  203. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  204. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  205. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  206. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  207. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  208. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  209. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  210. package/dist/types/excalidraw/components/Toast.d.ts +11 -7
  211. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  212. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  213. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +8 -4
  214. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
  215. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  216. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
  217. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
  218. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  219. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  220. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  221. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  222. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
  223. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  224. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  225. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  226. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  227. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  228. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  229. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  230. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  231. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  232. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
  233. package/dist/types/excalidraw/components/icons.d.ts +51 -21
  234. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +24 -3
  235. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  236. package/dist/types/excalidraw/components/shapes.d.ts +209 -1
  237. package/dist/types/excalidraw/data/blob.d.ts +331 -12
  238. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  239. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  240. package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
  241. package/dist/types/excalidraw/data/index.d.ts +8 -9
  242. package/dist/types/excalidraw/data/json.d.ts +171 -3
  243. package/dist/types/excalidraw/data/library.d.ts +25 -10
  244. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  245. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  246. package/dist/types/excalidraw/data/types.d.ts +4 -1
  247. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  248. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  249. package/dist/types/excalidraw/errors.d.ts +14 -0
  250. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  251. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
  252. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  253. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  254. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  255. package/dist/types/excalidraw/i18n.d.ts +2 -2
  256. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  257. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  258. package/dist/types/excalidraw/renderer/animation.d.ts +16 -0
  259. package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
  260. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
  261. package/dist/types/excalidraw/scene/Renderer.d.ts +428 -18
  262. package/dist/types/excalidraw/scene/export.d.ts +4 -4
  263. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  264. package/dist/types/excalidraw/scene/types.d.ts +23 -8
  265. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  266. package/dist/types/excalidraw/snapping.d.ts +12 -12
  267. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  268. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  269. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  270. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  271. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  272. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  273. package/dist/types/excalidraw/types.d.ts +294 -43
  274. package/dist/types/excalidraw/viewport.d.ts +316 -0
  275. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +8 -5
  276. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  277. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  278. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  279. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  280. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  281. package/dist/types/math/src/constants.d.ts +0 -1
  282. package/dist/types/math/src/curve.d.ts +4 -1
  283. package/dist/types/math/src/point.d.ts +8 -2
  284. package/dist/types/math/src/polygon.d.ts +2 -2
  285. package/dist/types/math/src/range.d.ts +1 -3
  286. package/dist/types/math/src/segment.d.ts +4 -3
  287. package/dist/types/math/src/types.d.ts +25 -1
  288. package/dist/types/utils/src/export.d.ts +8 -8
  289. package/dist/types/utils/src/index.d.ts +1 -2
  290. package/dist/types/utils/src/shape.d.ts +6 -6
  291. package/package.json +10 -3
  292. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  293. package/dist/types/excalidraw/charts.d.ts +0 -27
  294. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  295. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -16
  296. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  297. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
  298. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  299. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
  300. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  301. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  302. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -85
  303. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  304. package/dist/types/excalidraw/index.d.ts +0 -47
  305. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  306. package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
  307. package/dist/types/utils/src/bbox.d.ts +0 -9
  308. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -0,0 +1,316 @@
1
+ import type { SceneBounds } from "@excalidraw/element";
2
+ import type { Bounds } from "@excalidraw/common";
3
+ import type { ExcalidrawElement, NonDeleted, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
4
+ import type { AppState, NormalizedZoomValue, Offsets, PointerCoords, ScrollConstraints, ViewportOffsets, Zoom } from "./types";
5
+ export declare const SCROLL_TO_CONTENT_ANIMATION_KEY = "animateScrollToContent";
6
+ /** default rubberband overscroll give for scroll locks, in viewport px */
7
+ export declare const DEFAULT_OVERSCROLL = 150;
8
+ export type AnimationOptions = {
9
+ duration?: number;
10
+ };
11
+ export type SetViewportRect = {
12
+ x: number;
13
+ y: number;
14
+ width?: number;
15
+ height?: number;
16
+ };
17
+ export declare const isSetViewportRect: (target: unknown) => target is SetViewportRect;
18
+ export type SetViewportOptions = {
19
+ /**
20
+ * what to show in the viewport: an explicit scene-coordinate box/rect,
21
+ * element(s), or an element id / element-link URL.
22
+ *
23
+ * IMPORTANT: if supplying ExcalidrawElement(s), only non-deleted elements
24
+ * that actually exist on the canvas are considered. If you want to navigate
25
+ * to elements that's not on canvas yet, supply their bounds by using
26
+ * `getCommonBounds` (see {@link getCommonBounds}).
27
+ */
28
+ target: Bounds | SetViewportRect | ExcalidrawElement | readonly ExcalidrawElement[] | string;
29
+ /**
30
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/object-fit
31
+ *
32
+ * - `scale-down` - zoom out so the target fits the viewport, never zooming past 100%
33
+ * - `contain` - zoom the target so it fills the viewport (may exceed 100%)
34
+ * - `none` - keep the current zoom, only center the target in the viewport
35
+ */
36
+ fit?: "scale-down" | "contain" | "none";
37
+ lock?: {
38
+ /** constraints panning to the target box */
39
+ scroll?: ScrollConstraints["lockScroll"];
40
+ /** makes the resolved zoom the minimum zoom */
41
+ zoom?: ScrollConstraints["lockZoom"];
42
+ /**
43
+ * Rubberband give past the lock, in viewport px (zoom-independent): how
44
+ * far the user can pan beyond the constraint before snapping back.
45
+ * `true` (default) uses {@link DEFAULT_OVERSCROLL}, `false` disables
46
+ * (rigid lock), a number sets the give explicitly.
47
+ */
48
+ overscroll?: boolean | number;
49
+ };
50
+ animation?: AnimationOptions | boolean;
51
+ /**
52
+ * CSS-style per-side viewport insets, in viewport pixels
53
+ * (zoom-independent) — static values, editor-UI-derived (`ui`), or a
54
+ * combination. See {@link ViewportOffsets}.
55
+ */
56
+ offsets?: ViewportOffsets;
57
+ };
58
+ type Viewport = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
59
+ /**
60
+ * Clamps a proposed scroll/zoom against the active lock (`scrollConstraints`).
61
+ * Returns the input scroll/zoom unchanged when there is no lock.
62
+ * `overscroll` (screen px, zoom-independent) is rubberband give past the
63
+ * resting clamp — pass 0 for a hard clamp.
64
+ */
65
+ export declare const constrainScrollState: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, overscroll?: number) => Viewport;
66
+ export declare const isViewportOverscrolled: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">) => boolean;
67
+ /**
68
+ * Rubberband snap-back: animates the viewport from its current (possibly
69
+ * overscrolled) position back inside the lock box via the shared
70
+ * AnimationController. No-op when already within the hard bounds (or when there
71
+ * is no lock).
72
+ */
73
+ export declare const animateToConstraints: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "width" | "height" | "scrollConstraints">, onFrame: (viewport: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom">) => void, duration?: number) => void;
74
+ /**
75
+ * Scrolls (and, per `fit`, zooms) the viewport so the given target box is in
76
+ * view, optionally animating the transition. `onComplete` runs once the
77
+ * viewport has settled on the target.
78
+ */
79
+ export declare const setViewportToBounds: (state: AppState, bounds: Bounds, opts: Pick<SetViewportOptions, "fit" | "animation"> & {
80
+ offsets?: Offsets;
81
+ }, onFrame: (state: Pick<AppState, "scrollX" | "scrollY" | "zoom" | "shouldCacheIgnoreZoom">) => void, onComplete?: () => void) => void;
82
+ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, minZoom, maxZoom, steppedZoom, }: {
83
+ bounds: SceneBounds;
84
+ canvasOffsets?: Offsets;
85
+ appState: Readonly<AppState>;
86
+ fit?: SetViewportOptions["fit"];
87
+ minZoom?: number;
88
+ maxZoom?: number;
89
+ steppedZoom?: boolean;
90
+ }) => {
91
+ appState: {
92
+ scrollX: number;
93
+ scrollY: number;
94
+ zoom: {
95
+ value: NormalizedZoomValue;
96
+ };
97
+ contextMenu: {
98
+ items: import("./components/ContextMenu").ContextMenuItems;
99
+ top: number;
100
+ left: number;
101
+ } | null;
102
+ showWelcomeScreen: boolean;
103
+ isLoading: boolean;
104
+ errorMessage: React.ReactNode;
105
+ activeEmbeddable: {
106
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
107
+ state: "hover" | "active";
108
+ } | null;
109
+ newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
110
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
111
+ multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
112
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
113
+ isBindingEnabled: boolean;
114
+ boxSelectionMode: import("./types").BoxSelectionMode;
115
+ bindingPreference: "enabled" | "disabled";
116
+ isMidpointSnappingEnabled: boolean;
117
+ suggestedBinding: {
118
+ element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
119
+ midPoint?: import("@excalidraw/math").GlobalPoint;
120
+ } | null;
121
+ frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
122
+ frameRendering: {
123
+ enabled: boolean;
124
+ name: boolean;
125
+ outline: boolean;
126
+ clip: boolean;
127
+ };
128
+ editingFrame: string | null;
129
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
130
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
131
+ activeTool: {
132
+ lastActiveTool: import("./types").ActiveTool | null;
133
+ locked: boolean;
134
+ fromSelection: boolean;
135
+ } & import("./types").ActiveTool;
136
+ preferredSelectionTool: {
137
+ type: "selection" | "lasso";
138
+ initialized: boolean;
139
+ };
140
+ penMode: boolean;
141
+ penDetected: boolean;
142
+ exportBackground: boolean;
143
+ exportEmbedScene: boolean;
144
+ exportWithDarkMode: boolean;
145
+ exportScale: number;
146
+ currentItemStrokeColor: string;
147
+ currentItemBackgroundColor: string;
148
+ currentItemFillStyle: ExcalidrawElement["fillStyle"];
149
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
150
+ currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
151
+ currentItemRoughness: number;
152
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
153
+ currentItemOpacity: number;
154
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
155
+ currentItemFontSize: number;
156
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
157
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
158
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
159
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
160
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
161
+ currentItemArrowType: "sharp" | "round" | "elbow";
162
+ viewBackgroundColor: string;
163
+ scrollConstraints: ScrollConstraints | null;
164
+ cursorButton: "up" | "down";
165
+ scrolledOutside: boolean;
166
+ name: string | null;
167
+ isResizing: boolean;
168
+ isRotating: boolean;
169
+ openMenu: "canvas" | null;
170
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
171
+ openSidebar: {
172
+ name: import("./types").SidebarName;
173
+ tab?: import("./types").SidebarTabName;
174
+ } | null;
175
+ openDialog: null | {
176
+ name: "imageExport" | "help" | "jsonExport";
177
+ } | {
178
+ name: "ttd";
179
+ tab: "text-to-diagram" | "mermaid";
180
+ } | {
181
+ name: "commandPalette";
182
+ } | {
183
+ name: "settings";
184
+ } | {
185
+ name: "elementLinkSelector";
186
+ sourceElementId: ExcalidrawElement["id"];
187
+ } | {
188
+ name: "charts";
189
+ data: import("./charts").Spreadsheet;
190
+ rawText: string;
191
+ };
192
+ defaultSidebarDockedPreference: boolean;
193
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
194
+ selectedElementIds: Readonly<{
195
+ [id: string]: true;
196
+ }>;
197
+ hoveredElementIds: Readonly<{
198
+ [id: string]: true;
199
+ }>;
200
+ previousSelectedElementIds: {
201
+ [id: string]: true;
202
+ };
203
+ selectedElementsAreBeingDragged: boolean;
204
+ shouldCacheIgnoreZoom: boolean;
205
+ toast: {
206
+ message: React.ReactNode;
207
+ closable?: boolean;
208
+ duration?: number;
209
+ } | null;
210
+ zenModeEnabled: boolean;
211
+ theme: import("@excalidraw/element/types").Theme;
212
+ gridSize: number;
213
+ gridStep: number;
214
+ gridModeEnabled: boolean;
215
+ viewModeEnabled: boolean;
216
+ selectedGroupIds: {
217
+ [groupId: string]: boolean;
218
+ };
219
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
220
+ width: number;
221
+ height: number;
222
+ offsetTop: number;
223
+ offsetLeft: number;
224
+ fileHandle: FileSystemFileHandle | null;
225
+ collaborators: Map<import("./types").SocketId, import("./types").Collaborator>;
226
+ stats: {
227
+ open: boolean;
228
+ panels: number;
229
+ };
230
+ showHyperlinkPopup: false | "info" | "editor";
231
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
232
+ snapLines: readonly import("./snapping").SnapLine[];
233
+ originSnapOffset: {
234
+ x: number;
235
+ y: number;
236
+ } | null;
237
+ objectsSnapModeEnabled: boolean;
238
+ userToFollow: import("./types").UserToFollow | null;
239
+ followedBy: Set<import("./types").SocketId>;
240
+ isCropping: boolean;
241
+ croppingElementId: ExcalidrawElement["id"] | null;
242
+ searchMatches: Readonly<{
243
+ focusedId: ExcalidrawElement["id"] | null;
244
+ matches: readonly import("./types").SearchMatch[];
245
+ }> | null;
246
+ activeLockedId: string | null;
247
+ lockedMultiSelections: {
248
+ [groupId: string]: true;
249
+ };
250
+ bindMode: import("@excalidraw/element/types").BindMode;
251
+ };
252
+ captureUpdate: "EVENTUALLY";
253
+ };
254
+ /** Computes the viewport (scroll + zoom) that brings the target box into view,
255
+ * based on the requested fit behavior. */
256
+ export declare const getTargetViewport: (state: AppState, bounds: Bounds, fit?: SetViewportOptions["fit"], offsets?: Offsets) => Viewport;
257
+ export type ResolvedViewportTarget = {
258
+ /** null when the target couldn't be resolved (unknown id/link, or all
259
+ * supplied elements deleted) */
260
+ bounds: Bounds | null;
261
+ /** how the target was specified, so callers can react to unresolved
262
+ * targets themselves (e.g. toast on a broken element link) */
263
+ type: "element" | "area" | "link";
264
+ };
265
+ /** Resolves a `setViewport` target to a scene-coordinate box. */
266
+ export declare const resolveViewportTarget: (target: SetViewportOptions["target"], elementsMap: NonDeletedSceneElementsMap, appState: Pick<AppState, "width" | "height">) => ResolvedViewportTarget;
267
+ /** Computes the viewport patch for landing on `bounds`: the target
268
+ * scroll/zoom, plus the scroll lock to install — or `scrollConstraints: null`
269
+ * to clear a previous lock when none is requested. */
270
+ export declare const getConstrainedTargetViewport: (appState: AppState, bounds: Bounds, { fit, offsets, lock, }: Pick<SetViewportOptions, "fit" | "lock"> & {
271
+ offsets?: Offsets;
272
+ }) => Viewport & {
273
+ scrollConstraints: ScrollConstraints | null;
274
+ };
275
+ /**
276
+ * Interpolates the viewport from `from` to `target` at the (already-eased)
277
+ * blend amount `factor` (0 = `from`, 1 = `target`).
278
+ *
279
+ * Zoom is interpolated geometrically (so it feels uniform), but the pan can't
280
+ * simply lerp alongside it: pairing a geometric zoom with a linear scroll (or
281
+ * a linearly-tweened focal point) makes scene points swoop along curved,
282
+ * non-monotone screen paths once the zoom ratio exceeds ~e (the destination
283
+ * visibly drifts away before converging). Instead we interpolate the view
284
+ * transform affinely — a scene point maps to screen as
285
+ * `(scenePt + scroll) * zoom`, and requiring every point to travel a straight
286
+ * screen line forces `zoom` to be a convex blend `(1-m)*z0 + m*z1` with
287
+ * `scroll * zoom` lerped by that same weight. Deriving `m` from the geometric
288
+ * zoom keeps its pacing while making all screen trajectories straight and
289
+ * monotone.
290
+ */
291
+ export declare const interpolateViewport: ({ from, target, factor, }: {
292
+ from: Viewport;
293
+ target: Viewport;
294
+ factor: number;
295
+ }) => Viewport;
296
+ export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
297
+ x: number;
298
+ y: number;
299
+ }) => Bounds;
300
+ export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, offsets, }: {
301
+ scenePoint: PointerCoords;
302
+ viewportDimensions: {
303
+ height: number;
304
+ width: number;
305
+ };
306
+ zoom: Zoom;
307
+ offsets?: Offsets;
308
+ }) => {
309
+ scrollX: number;
310
+ scrollY: number;
311
+ };
312
+ export declare const getScrollToContentState: (elements: readonly ExcalidrawElement[], appState: AppState) => {
313
+ scrollX: number;
314
+ scrollY: number;
315
+ };
316
+ export {};
@@ -1,15 +1,14 @@
1
- import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawTextElement } from "@excalidraw/element/types";
2
2
  import type App from "../components/App";
3
3
  type SubmitHandler = () => void;
4
- export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
5
- id: ExcalidrawElement["id"];
4
+ export declare const textWysiwyg: ({ onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, initialCaretSceneCoords, }: {
6
5
  /**
7
6
  * textWysiwyg only deals with `originalText`
8
7
  *
9
8
  * Note: `text`, which can be wrapped and therefore different from `originalText`,
10
9
  * is derived from `originalText`
11
10
  */
12
- onChange?: ((nextOriginalText: string) => void) | undefined;
11
+ onChange?: (nextOriginalText: string) => void;
13
12
  onSubmit: (data: {
14
13
  viaKeyboard: boolean;
15
14
  nextOriginalText: string;
@@ -19,6 +18,10 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
19
18
  canvas: HTMLCanvasElement;
20
19
  excalidrawContainer: HTMLDivElement | null;
21
20
  app: App;
22
- autoSelect?: boolean | undefined;
21
+ autoSelect?: boolean;
22
+ initialCaretSceneCoords?: {
23
+ x: number;
24
+ y: number;
25
+ } | null;
23
26
  }) => SubmitHandler;
24
27
  export {};
@@ -0,0 +1,29 @@
1
+ export declare const BASE_62_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
2
+ /**
3
+ * @param {string} key
4
+ * @param {string} digits
5
+ * @return {void}
6
+ */
7
+ export declare function validateOrderKey(key: string, digits?: string): void;
8
+ /**
9
+ * @param {string | null | undefined} a
10
+ * @param {string | null | undefined} b
11
+ * @param {string=} digits
12
+ * @return {string}
13
+ */
14
+ export declare function generateKeyBetween(a: string | null | undefined, b: string | null | undefined, digits?: string): string;
15
+ /**
16
+ * same preconditions as generateKeysBetween.
17
+ * n >= 0.
18
+ * Returns an array of n distinct keys in sorted order.
19
+ * If a and b are both null, returns [a0, a1, ...]
20
+ * If one or the other is null, returns consecutive "integer"
21
+ * keys. Otherwise, returns relatively short keys between
22
+ * a and b.
23
+ * @param {string | null | undefined} a
24
+ * @param {string | null | undefined} b
25
+ * @param {number} n
26
+ * @param {string} digits
27
+ * @return {string[]}
28
+ */
29
+ export declare function generateNKeysBetween(a: string | null | undefined, b: string | null | undefined, n: number, digits?: string): string[];
@@ -0,0 +1,2 @@
1
+ export * from "./state";
2
+ export type { Point } from "./math";
@@ -0,0 +1,16 @@
1
+ export type Point = [x: number, y: number, r: number];
2
+ export declare function add([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
3
+ export declare function sub([ax, ay, ar]: Point, [bx, by, br]: Point): Point;
4
+ export declare function smul([x, y, r]: Point, s: number): Point;
5
+ export declare function norm([x, y, r]: Point): Point;
6
+ export declare function rot([x, y, r]: Point, rad: number): Point;
7
+ export declare function plerp(a: Point, b: Point, t: number): Point;
8
+ export declare function lerp(a: number, b: number, t: number): number;
9
+ export declare function angle(p: Point, p1: Point, p2: Point): number;
10
+ export declare function normAngle(a: number): number;
11
+ export declare function mag([x, y]: Point): number;
12
+ export declare function dist([ax, ay]: Point, [bx, by]: Point): number;
13
+ export declare function getCircleAndPerpendicularLineIntersectionsAtPoint(point: Point, direction: Point, radius: number): [Point, Point];
14
+ export declare function runLength(ps: Point[]): number;
15
+ export declare const clamp: (v: number, min: number, max: number) => number;
16
+ export declare function distancePointToSegment(p3: Point, p1: Point, p2: Point): number;
@@ -0,0 +1,2 @@
1
+ import { type Point } from "./math";
2
+ export declare function douglasPeucker(points: Point[], epsilon: number): Point[];
@@ -0,0 +1,35 @@
1
+ import type { Point } from "./math";
2
+ export type SizeMappingDetails = {
3
+ pressure: number;
4
+ runningLength: number;
5
+ currentIndex: number;
6
+ totalLength: number;
7
+ };
8
+ export type LaserPointerOptions = {
9
+ size: number;
10
+ streamline: number;
11
+ simplify: number;
12
+ simplifyPhase: "tail" | "output" | "input";
13
+ keepHead: boolean;
14
+ sizeMapping: (details: SizeMappingDetails) => number;
15
+ };
16
+ export declare class LaserPointer {
17
+ static defaults: LaserPointerOptions;
18
+ static constants: {
19
+ cornerDetectionMaxAngle: number;
20
+ cornerDetectionVariance: (s: number) => 1 | 0.5;
21
+ maxTailLength: number;
22
+ };
23
+ options: LaserPointerOptions;
24
+ constructor(options: Partial<LaserPointerOptions>);
25
+ originalPoints: Point[];
26
+ private stablePoints;
27
+ private tailPoints;
28
+ private isFresh;
29
+ private get lastPoint();
30
+ addPoint(point: Point): void;
31
+ close(): void;
32
+ stabilizeTail(): void;
33
+ private getSize;
34
+ getStrokeOutline(sizeOverride?: number | undefined): Point[];
35
+ }
@@ -1,3 +1,2 @@
1
- export declare const PRECISION = 0.0001;
2
1
  export declare const LegendreGaussN24TValues: number[];
3
2
  export declare const LegendreGaussN24CValues: number[];
@@ -12,7 +12,10 @@ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c:
12
12
  /**
13
13
  * Computes the intersection between a cubic spline and a line segment.
14
14
  */
15
- export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>): Point[];
15
+ export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>, opts?: {
16
+ tolerance?: number;
17
+ iterLimit?: number;
18
+ }): Point[];
16
19
  /**
17
20
  * Finds the closest point on the Bezier curve from another point
18
21
  *
@@ -1,4 +1,4 @@
1
- import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types";
1
+ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector, GlobalCoord, LocalCoord } from "./types";
2
2
  /**
3
3
  * Create a properly typed Point instance from the X and Y coordinates.
4
4
  *
@@ -7,6 +7,11 @@ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types"
7
7
  * @returns The branded and created point
8
8
  */
9
9
  export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(x: number, y: number): Point;
10
+ export declare function pointFrom<Coord extends GlobalCoord | LocalCoord>(coords: Coord): Coord extends GlobalCoord ? GlobalPoint : LocalPoint;
11
+ export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(coords: {
12
+ x: number;
13
+ y: number;
14
+ }): Point;
10
15
  /**
11
16
  * Converts and remaps an array containing a pair of numbers to Point.
12
17
  *
@@ -52,7 +57,7 @@ export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: P
52
57
  * @param angle The radians to rotate the point by
53
58
  * @returns The rotated point
54
59
  */
55
- export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>([x, y]: Point, [cx, cy]: Point, angle: Radians): Point;
60
+ export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>(point: Point, center: Point, angle: Radians): Point;
56
61
  /**
57
62
  * Rotate a point by [angle] degree.
58
63
  *
@@ -120,3 +125,4 @@ export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(
120
125
  * @returns TRUE if q is indeed between p and r
121
126
  */
122
127
  export declare const isPointWithinBounds: <P extends GlobalPoint | LocalPoint>(p: P, q: P, r: P) => boolean;
128
+ export declare const isValidPoint: (point: unknown) => point is LocalPoint;
@@ -1,6 +1,6 @@
1
1
  import type { GlobalPoint, LocalPoint, Polygon } from "./types";
2
2
  export declare function polygon<Point extends GlobalPoint | LocalPoint>(...points: Point[]): Polygon<Point>;
3
3
  export declare function polygonFromPoints<Point extends GlobalPoint | LocalPoint>(points: Point[]): Polygon<Point>;
4
- export declare const polygonIncludesPoint: <Point extends GlobalPoint | LocalPoint>(point: Point, polygon: Polygon<Point>) => boolean;
4
+ export declare const polygonIncludesPoint: <Point extends LocalPoint | GlobalPoint>(point: Point, polygon: Polygon<Point>) => boolean;
5
5
  export declare const polygonIncludesPointNonZero: <Point extends [number, number]>(point: Point, polygon: Point[]) => boolean;
6
- export declare const pointOnPolygon: <Point extends GlobalPoint | LocalPoint>(p: Point, poly: Polygon<Point>, threshold?: number) => boolean;
6
+ export declare const pointOnPolygon: <Point extends LocalPoint | GlobalPoint>(p: Point, poly: Polygon<Point>, threshold?: number) => boolean;
@@ -13,9 +13,7 @@ export declare function rangeInclusive(start: number, end: number): InclusiveRan
13
13
  * @param pair The number pair to convert to an inclusive range
14
14
  * @returns The new inclusive range
15
15
  */
16
- export declare function rangeInclusiveFromPair(pair: [start: number, end: number]): [number, number] & {
17
- _brand: "excalimath_degree";
18
- };
16
+ export declare function rangeInclusiveFromPair(pair: [start: number, end: number]): InclusiveRange;
19
17
  /**
20
18
  * Given two ranges, return if the two ranges overlap with each other e.g.
21
19
  * [1, 3] overlaps with [2, 4] while [1, 3] does not overlap with [4, 5].
@@ -21,14 +21,14 @@ export declare const isLineSegment: <Point extends GlobalPoint | LocalPoint>(seg
21
21
  * @param origin
22
22
  * @returns
23
23
  */
24
- export declare const lineSegmentRotate: <Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, angle: Radians, origin?: Point | undefined) => LineSegment<Point>;
24
+ export declare const lineSegmentRotate: <Point extends LocalPoint | GlobalPoint>(l: LineSegment<Point>, angle: Radians, origin?: Point) => LineSegment<Point>;
25
25
  /**
26
26
  * Calculates the point two line segments with a definite start and end point
27
27
  * intersect at.
28
28
  */
29
29
  export declare const segmentsIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
30
- export declare const pointOnLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
31
- export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>) => number;
30
+ export declare const pointOnLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
31
+ export declare const distanceToLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>) => number;
32
32
  /**
33
33
  * Returns the intersection point of a segment and a line
34
34
  *
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
37
37
  * @returns
38
38
  */
39
39
  export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
40
+ export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
@@ -19,12 +19,24 @@ export type InclusiveRange = [number, number] & {
19
19
  _brand: "excalimath_degree";
20
20
  };
21
21
  /**
22
- * Represents a 2D position in world or canvas space. A
22
+ * Represents a 2D position in world/canvas/scene space. A
23
23
  * global coordinate.
24
24
  */
25
25
  export type GlobalPoint = [x: number, y: number] & {
26
26
  _brand: "excalimath__globalpoint";
27
27
  };
28
+ /**
29
+ * Represents a 2D position in world/canvas/scene space. A
30
+ * global coordinate.
31
+ *
32
+ * TODO remove this once we migrate the codebase to use Point tuples everywhere
33
+ */
34
+ export type GlobalCoord = {
35
+ x: number;
36
+ y: number;
37
+ } & {
38
+ _brand: "excalimath__globalcoord";
39
+ };
28
40
  /**
29
41
  * Represents a 2D position in whatever local space it's
30
42
  * needed. A local coordinate.
@@ -32,6 +44,18 @@ export type GlobalPoint = [x: number, y: number] & {
32
44
  export type LocalPoint = [x: number, y: number] & {
33
45
  _brand: "excalimath__localpoint";
34
46
  };
47
+ /**
48
+ * Represents a 2D position in whatever local space it's needed.
49
+ * A local coordinate.
50
+ *
51
+ * TODO remove this once we migrate the codebase to use Point tuples everywhere
52
+ */
53
+ export type LocalCoord = {
54
+ x: number;
55
+ y: number;
56
+ } & {
57
+ _brand: "excalimath__localcoord";
58
+ };
35
59
  /**
36
60
  * A line is an infinitely long object with no width, depth, or curvature.
37
61
  */
@@ -1,13 +1,13 @@
1
1
  import { MIME_TYPES } from "@excalidraw/common";
2
- import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted } from "@excalidraw/element/types";
2
+ import type { ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
4
4
  export { MIME_TYPES };
5
5
  type ExportOpts = {
6
- elements: readonly NonDeleted<ExcalidrawElement>[];
6
+ elements: readonly NonDeletedExcalidrawElement[];
7
7
  appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
8
8
  files: BinaryFiles | null;
9
9
  maxWidthOrHeight?: number;
10
- exportingFrame?: ExcalidrawFrameLikeElement | null;
10
+ exportingFrame?: NonDeleted<ExcalidrawFrameLikeElement> | null;
11
11
  getDimensions?: (width: number, height: number) => {
12
12
  width: number;
13
13
  height: number;
@@ -15,7 +15,7 @@ type ExportOpts = {
15
15
  };
16
16
  };
17
17
  export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, exportingFrame, }: ExportOpts & {
18
- exportPadding?: number | undefined;
18
+ exportPadding?: number;
19
19
  }) => Promise<HTMLCanvasElement>;
20
20
  export declare const exportToBlob: (opts: ExportOpts & {
21
21
  mimeType?: string;
@@ -23,10 +23,10 @@ export declare const exportToBlob: (opts: ExportOpts & {
23
23
  exportPadding?: number;
24
24
  }) => Promise<Blob>;
25
25
  export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, exportingFrame, skipInliningFonts, reuseImages, }: Omit<ExportOpts, "getDimensions"> & {
26
- exportPadding?: number | undefined;
27
- renderEmbeddables?: boolean | undefined;
28
- skipInliningFonts?: true | undefined;
29
- reuseImages?: boolean | undefined;
26
+ exportPadding?: number;
27
+ renderEmbeddables?: boolean;
28
+ skipInliningFonts?: true;
29
+ reuseImages?: boolean;
30
30
  }) => Promise<SVGSVGElement>;
31
31
  export declare const exportToClipboard: (opts: ExportOpts & {
32
32
  mimeType?: string;
@@ -1,4 +1,3 @@
1
1
  export * from "./export";
2
- export * from "./withinBounds";
3
- export * from "./bbox";
2
+ export { elementsOverlappingBBox } from "@excalidraw/element";
4
3
  export { getCommonBounds } from "@excalidraw/element";
@@ -46,13 +46,13 @@ export declare const getClosedCurveShape: <Point extends GlobalPoint | LocalPoin
46
46
  * @param gap Optional value to inflate the shape before testing
47
47
  * @returns An array of intersections
48
48
  */
49
- export declare const segmentIntersectRectangleElement: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawBindableElement, segment: LineSegment<Point>, gap?: number) => Point[];
50
- export declare const pointOnEllipse: <Point extends GlobalPoint | LocalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
51
- export declare const pointInEllipse: <Point extends GlobalPoint | LocalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
52
- export declare const ellipseAxes: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => {
49
+ export declare const segmentIntersectRectangleElement: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawBindableElement, segment: LineSegment<Point>, gap?: number) => Point[];
50
+ export declare const pointOnEllipse: <Point extends LocalPoint | GlobalPoint>(point: Point, ellipse: Ellipse<Point>, threshold?: number) => boolean;
51
+ export declare const pointInEllipse: <Point extends LocalPoint | GlobalPoint>(p: Point, ellipse: Ellipse<Point>) => boolean;
52
+ export declare const ellipseAxes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => {
53
53
  majorAxis: number;
54
54
  minorAxis: number;
55
55
  };
56
- export declare const ellipseFocusToCenter: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => number;
57
- export declare const ellipseExtremes: <Point extends GlobalPoint | LocalPoint>(ellipse: Ellipse<Point>) => import("@excalidraw/math").Vector[];
56
+ export declare const ellipseFocusToCenter: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => number;
57
+ export declare const ellipseExtremes: <Point extends LocalPoint | GlobalPoint>(ellipse: Ellipse<Point>) => import("@excalidraw/math").Vector[];
58
58
  export {};