@dwelle/excalidraw 0.6.0-rc.1 → 0.6.0-rc.3

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 (233) hide show
  1. package/README.md +3 -4
  2. package/dist/dev/{chunk-EFVS2MI5.js → chunk-FCTATTEX.js} +2 -2
  3. package/dist/dev/{chunk-EFVS2MI5.js.map → chunk-FCTATTEX.js.map} +1 -1
  4. package/dist/dev/chunk-GPAPUEH7.js +25914 -0
  5. package/dist/dev/chunk-GPAPUEH7.js.map +7 -0
  6. package/dist/dev/data/image-KIZE4OBD.js +13 -0
  7. package/dist/dev/index.css.map +1 -1
  8. package/dist/dev/index.js +33243 -37
  9. package/dist/dev/index.js.map +4 -4
  10. package/dist/dev/subset-shared.chunk.js +1 -1
  11. package/dist/dev/subset-worker.chunk.js +1 -1
  12. package/dist/prod/{chunk-P7457GAF.js → chunk-DZ7HA6XS.js} +1 -1
  13. package/dist/prod/chunk-TQDSDB2B.js +46 -0
  14. package/dist/prod/data/image-SCXWNX5A.js +1 -0
  15. package/dist/prod/index.js +108 -1
  16. package/dist/prod/subset-shared.chunk.js +1 -1
  17. package/dist/prod/subset-worker.chunk.js +1 -1
  18. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
  19. package/dist/types/excalidraw/actions/actionAlign.d.ts +18 -18
  20. package/dist/types/excalidraw/actions/actionBoundText.d.ts +3 -3
  21. package/dist/types/excalidraw/actions/actionCanvas.d.ts +31 -31
  22. package/dist/types/excalidraw/actions/actionClipboard.d.ts +17 -17
  23. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +3 -3
  24. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +5 -5
  25. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
  26. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -3
  27. package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
  28. package/dist/types/excalidraw/actions/actionElementLock.d.ts +4 -4
  29. package/dist/types/excalidraw/actions/actionExport.d.ts +30 -30
  30. package/dist/types/excalidraw/actions/actionFinalize.d.ts +3 -3
  31. package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
  32. package/dist/types/excalidraw/actions/actionFrame.d.ts +9 -9
  33. package/dist/types/excalidraw/actions/actionGroup.d.ts +8 -8
  34. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
  36. package/dist/types/excalidraw/actions/actionMenu.d.ts +6 -6
  37. package/dist/types/excalidraw/actions/actionNavigate.d.ts +3 -3
  38. package/dist/types/excalidraw/actions/actionProperties.d.ts +31 -31
  39. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -2
  40. package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -5
  41. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  42. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -2
  43. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -2
  44. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +3 -3
  45. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  46. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -2
  47. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -2
  48. package/dist/types/excalidraw/actions/actionZindex.d.ts +14 -14
  49. package/dist/types/excalidraw/actions/manager.d.ts +1 -1
  50. package/dist/types/excalidraw/actions/types.d.ts +2 -2
  51. package/dist/types/excalidraw/appState.d.ts +9 -9
  52. package/dist/types/excalidraw/clipboard.d.ts +4 -4
  53. package/dist/types/excalidraw/components/Actions.d.ts +6 -7
  54. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -2
  55. package/dist/types/excalidraw/components/App.d.ts +13 -3
  56. package/dist/types/excalidraw/components/Avatar.d.ts +1 -1
  57. package/dist/types/excalidraw/components/BraveMeasureTextError.d.ts +1 -2
  58. package/dist/types/excalidraw/components/Button.d.ts +1 -1
  59. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -1
  60. package/dist/types/excalidraw/components/ButtonIconCycle.d.ts +2 -2
  61. package/dist/types/excalidraw/components/ButtonIconSelect.d.ts +2 -2
  62. package/dist/types/excalidraw/components/ButtonSelect.d.ts +1 -2
  63. package/dist/types/excalidraw/components/ButtonSeparator.d.ts +1 -2
  64. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +1 -2
  65. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +1 -2
  66. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -2
  67. package/dist/types/excalidraw/components/ColorPicker/HotkeyLabel.d.ts +1 -2
  68. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +1 -1
  69. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +1 -2
  70. package/dist/types/excalidraw/components/ColorPicker/PickerHeading.d.ts +1 -1
  71. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +1 -2
  72. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -2
  73. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -2
  74. package/dist/types/excalidraw/components/ConfirmDialog.d.ts +1 -2
  75. package/dist/types/excalidraw/components/ContextMenu.d.ts +1 -1
  76. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -2
  77. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
  78. package/dist/types/excalidraw/components/Dialog.d.ts +1 -1
  79. package/dist/types/excalidraw/components/DialogActionButton.d.ts +1 -1
  80. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -2
  81. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  82. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  83. package/dist/types/excalidraw/components/FixedSideContainer.d.ts +1 -1
  84. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +1 -2
  85. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -2
  86. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +2 -1
  87. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +1 -2
  88. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +1 -1
  89. package/dist/types/excalidraw/components/HandButton.d.ts +1 -2
  90. package/dist/types/excalidraw/components/HelpButton.d.ts +1 -2
  91. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -2
  92. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -2
  93. package/dist/types/excalidraw/components/IconPicker.d.ts +2 -2
  94. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +2 -3
  95. package/dist/types/excalidraw/components/InitializeApp.d.ts +1 -1
  96. package/dist/types/excalidraw/components/InlineIcon.d.ts +1 -2
  97. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +1 -1
  98. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +1 -2
  99. package/dist/types/excalidraw/components/LayerUI.d.ts +1 -1
  100. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  101. package/dist/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +1 -2
  102. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -2
  103. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -1
  104. package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +1 -2
  105. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +2 -2
  106. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -2
  107. package/dist/types/excalidraw/components/LockButton.d.ts +1 -2
  108. package/dist/types/excalidraw/components/MagicButton.d.ts +2 -2
  109. package/dist/types/excalidraw/components/MobileMenu.d.ts +2 -1
  110. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +4 -4
  111. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +6 -6
  112. package/dist/types/excalidraw/components/Paragraph.d.ts +1 -2
  113. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +1 -1
  114. package/dist/types/excalidraw/components/PenModeButton.d.ts +1 -2
  115. package/dist/types/excalidraw/components/Popover.d.ts +1 -1
  116. package/dist/types/excalidraw/components/ProjectName.d.ts +1 -2
  117. package/dist/types/excalidraw/components/PublishLibrary.d.ts +1 -2
  118. package/dist/types/excalidraw/components/RadioGroup.d.ts +1 -1
  119. package/dist/types/excalidraw/components/Range.d.ts +1 -2
  120. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -2
  121. package/dist/types/excalidraw/components/ScrollableList.d.ts +1 -1
  122. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -2
  123. package/dist/types/excalidraw/components/ShareableLinkDialog.d.ts +1 -2
  124. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +6 -6
  125. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -2
  126. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -1
  127. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -1
  128. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -1
  129. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -1
  130. package/dist/types/excalidraw/components/Sidebar/SidebarTrigger.d.ts +1 -2
  131. package/dist/types/excalidraw/components/Sidebar/common.d.ts +1 -0
  132. package/dist/types/excalidraw/components/Spinner.d.ts +1 -2
  133. package/dist/types/excalidraw/components/Stack.d.ts +2 -3
  134. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -2
  135. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  136. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +1 -1
  137. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -2
  138. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  139. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -2
  140. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -2
  141. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -2
  142. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -2
  143. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -2
  144. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -2
  145. package/dist/types/excalidraw/components/Stats/index.d.ts +4 -4
  146. package/dist/types/excalidraw/components/Switch.d.ts +1 -2
  147. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +1 -2
  148. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +1 -1
  149. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +1 -1
  150. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +2 -2
  151. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +1 -1
  152. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanels.d.ts +1 -1
  153. package/dist/types/excalidraw/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -2
  154. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -1
  155. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -1
  156. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -1
  157. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabs.d.ts +1 -1
  158. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +2 -1
  159. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +1 -1
  160. package/dist/types/excalidraw/components/Toast.d.ts +1 -1
  161. package/dist/types/excalidraw/components/Tooltip.d.ts +1 -1
  162. package/dist/types/excalidraw/components/UserList.d.ts +1 -1
  163. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -2
  164. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -2
  165. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  166. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +11 -11
  167. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +1 -1
  168. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +1 -1
  169. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +4 -3
  170. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -2
  171. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +1 -1
  172. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +1 -1
  173. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +2 -1
  174. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSeparator.d.ts +1 -2
  175. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +1 -1
  176. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -2
  177. package/dist/types/excalidraw/components/footer/Footer.d.ts +1 -2
  178. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +1 -2
  179. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -2
  180. package/dist/types/excalidraw/components/icons.d.ts +178 -178
  181. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +1 -1
  182. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +12 -13
  183. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +9 -9
  184. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +10 -10
  185. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +3 -4
  186. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +15 -15
  187. package/dist/types/excalidraw/constants.d.ts +1 -0
  188. package/dist/types/excalidraw/data/blob.d.ts +1 -1
  189. package/dist/types/excalidraw/element/ElementCanvasButtons.d.ts +1 -2
  190. package/dist/types/excalidraw/element/binding.d.ts +1 -2
  191. package/dist/types/excalidraw/element/collision.d.ts +10 -1
  192. package/dist/types/excalidraw/element/distance.d.ts +3 -0
  193. package/dist/types/excalidraw/element/embeddable.d.ts +1 -1
  194. package/dist/types/excalidraw/element/newElement.d.ts +1 -1
  195. package/dist/types/excalidraw/element/transformHandles.d.ts +2 -2
  196. package/dist/types/excalidraw/element/types.d.ts +1 -1
  197. package/dist/types/excalidraw/element/utils.d.ts +21 -0
  198. package/dist/types/excalidraw/fonts/FontMetadata.d.ts +1 -1
  199. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +1 -1
  200. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -1
  201. package/dist/types/excalidraw/index.d.ts +2 -4
  202. package/dist/types/excalidraw/shapes.d.ts +11 -12
  203. package/dist/types/excalidraw/store.d.ts +6 -6
  204. package/dist/types/excalidraw/types.d.ts +3 -2
  205. package/dist/types/excalidraw/utils.d.ts +3 -3
  206. package/dist/types/excalidraw/visualdebug.d.ts +7 -8
  207. package/dist/types/excalidraw/zindex.d.ts +2 -2
  208. package/dist/types/math/curve.d.ts +22 -14
  209. package/dist/types/math/ellipse.d.ts +44 -0
  210. package/dist/types/math/index.d.ts +1 -1
  211. package/dist/types/math/line.d.ts +2 -30
  212. package/dist/types/math/point.d.ts +1 -29
  213. package/dist/types/math/rectangle.d.ts +3 -0
  214. package/dist/types/math/segment.d.ts +8 -1
  215. package/dist/types/math/types.d.ts +15 -6
  216. package/dist/types/math/vector.d.ts +0 -4
  217. package/dist/types/utils/export.d.ts +1 -1
  218. package/package.json +6 -14
  219. package/dist/dev/chunk-637CAVTS.js +0 -57639
  220. package/dist/dev/chunk-637CAVTS.js.map +0 -7
  221. package/dist/dev/data/image-N6Y7BWW6.css +0 -6753
  222. package/dist/dev/data/image-N6Y7BWW6.css.map +0 -7
  223. package/dist/dev/data/image-QMQX6YR5.js +0 -15
  224. package/dist/prod/chunk-PEDHHNBJ.js +0 -153
  225. package/dist/prod/data/image-IP6M4LZC.js +0 -1
  226. package/dist/prod/data/image-KGQIL6Y4.css +0 -1
  227. package/dist/types/math/arc.d.ts +0 -6
  228. package/dist/types/math/ga/ga.d.ts +0 -63
  229. package/dist/types/math/ga/gadirections.d.ts +0 -8
  230. package/dist/types/math/ga/galines.d.ts +0 -22
  231. package/dist/types/math/ga/gapoints.d.ts +0 -7
  232. package/dist/types/math/ga/gatransforms.d.ts +0 -10
  233. /package/dist/dev/data/{image-QMQX6YR5.js.map → image-KIZE4OBD.js.map} +0 -0
@@ -1,10 +1,10 @@
1
- export * from "./arc";
2
1
  export * from "./angle";
3
2
  export * from "./curve";
4
3
  export * from "./line";
5
4
  export * from "./point";
6
5
  export * from "./polygon";
7
6
  export * from "./range";
7
+ export * from "./rectangle";
8
8
  export * from "./segment";
9
9
  export * from "./triangle";
10
10
  export * from "./types";
@@ -1,4 +1,4 @@
1
- import type { GlobalPoint, Line, LocalPoint, Radians } from "./types";
1
+ import type { GlobalPoint, Line, LocalPoint } from "./types";
2
2
  /**
3
3
  * Create a line from two points.
4
4
  *
@@ -6,34 +6,6 @@ import type { GlobalPoint, Line, LocalPoint, Radians } from "./types";
6
6
  * @returns The line on which the points lie
7
7
  */
8
8
  export declare function line<P extends GlobalPoint | LocalPoint>(a: P, b: P): Line<P>;
9
- /**
10
- * Convenient point creation from an array of two points.
11
- *
12
- * @param param0 The array with the two points to convert to a line
13
- * @returns The created line
14
- */
15
- export declare function lineFromPointPair<P extends GlobalPoint | LocalPoint>([a, b]: [
16
- P,
17
- P
18
- ]): Line<P>;
19
- /**
20
- * TODO
21
- *
22
- * @param pointArray
23
- * @returns
24
- */
25
- export declare function lineFromPointArray<P extends GlobalPoint | LocalPoint>(pointArray: P[]): Line<P> | undefined;
26
- /**
27
- * Return the coordinates resulting from rotating the given line about an
28
- * origin by an angle in degrees note that when the origin is not given,
29
- * the midpoint of the given line is used as the origin
30
- *
31
- * @param l
32
- * @param angle
33
- * @param origin
34
- * @returns
35
- */
36
- export declare const lineRotate: <Point extends GlobalPoint | LocalPoint>(l: Line<Point>, angle: Radians, origin?: Point | undefined) => Line<Point>;
37
9
  /**
38
10
  * Determines the intersection point (unless the lines are parallel) of two
39
11
  * lines
@@ -42,4 +14,4 @@ export declare const lineRotate: <Point extends GlobalPoint | LocalPoint>(l: Lin
42
14
  * @param b
43
15
  * @returns
44
16
  */
45
- export declare const linesIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Line<Point>, b: Line<Point>) => Point | null;
17
+ export declare function linesIntersectAt<Point extends GlobalPoint | LocalPoint>(a: Line<Point>, b: Line<Point>): Point | null;
@@ -27,17 +27,7 @@ export declare function pointFromPair<Point extends GlobalPoint | LocalPoint>(pa
27
27
  * @param v The vector to convert
28
28
  * @returns The point the vector points at with origin 0,0
29
29
  */
30
- export declare function pointFromVector<P extends GlobalPoint | LocalPoint>(v: Vector): P;
31
- /**
32
- * Convert the coordiante object to a point.
33
- *
34
- * @param coords The coordinate object with x and y properties
35
- * @returns
36
- */
37
- export declare function pointFromCoords<Point extends GlobalPoint | LocalPoint>({ x, y, }: {
38
- x: number;
39
- y: number;
40
- }): Point;
30
+ export declare function pointFromVector<P extends GlobalPoint | LocalPoint>(v: Vector, offset?: P): P;
41
31
  /**
42
32
  * Checks if the provided value has the shape of a Point.
43
33
  *
@@ -93,24 +83,6 @@ export declare function pointTranslate<From extends GlobalPoint | LocalPoint, To
93
83
  * @returns The middle point
94
84
  */
95
85
  export declare function pointCenter<P extends LocalPoint | GlobalPoint>(a: P, b: P): P;
96
- /**
97
- * Add together two points by their coordinates like you'd apply a translation
98
- * to a point by a vector.
99
- *
100
- * @param a One point to act as a basis
101
- * @param b The other point to act like the vector to translate by
102
- * @returns
103
- */
104
- export declare function pointAdd<Point extends LocalPoint | GlobalPoint>(a: Point, b: Point): Point;
105
- /**
106
- * Subtract a point from another point like you'd translate a point by an
107
- * invese vector.
108
- *
109
- * @param a The point to translate
110
- * @param b The point which will act like a vector
111
- * @returns The resulting point
112
- */
113
- export declare function pointSubtract<Point extends LocalPoint | GlobalPoint>(a: Point, b: Point): Point;
114
86
  /**
115
87
  * Calculate the distance between two points.
116
88
  *
@@ -0,0 +1,3 @@
1
+ import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
2
+ export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
3
+ export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
@@ -6,7 +6,6 @@ import type { GlobalPoint, LineSegment, LocalPoint, Radians } from "./types";
6
6
  * @returns The line segment delineated by the points
7
7
  */
8
8
  export declare function lineSegment<P extends GlobalPoint | LocalPoint>(a: P, b: P): LineSegment<P>;
9
- export declare function lineSegmentFromPointArray<P extends GlobalPoint | LocalPoint>(pointArray: P[]): LineSegment<P> | undefined;
10
9
  /**
11
10
  *
12
11
  * @param segment
@@ -30,3 +29,11 @@ export declare const lineSegmentRotate: <Point extends GlobalPoint | LocalPoint>
30
29
  export declare const segmentsIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
31
30
  export declare const pointOnLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
32
31
  export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>) => number;
32
+ /**
33
+ * Returns the intersection point of a segment and a line
34
+ *
35
+ * @param l
36
+ * @param s
37
+ * @returns
38
+ */
39
+ export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>): Point | null;
@@ -62,6 +62,12 @@ export type Triangle<P extends GlobalPoint | LocalPoint> = [
62
62
  ] & {
63
63
  _brand: "excalimath__triangle";
64
64
  };
65
+ /**
66
+ * A rectangular shape represented by 4 points at its corners
67
+ */
68
+ export type Rectangle<P extends GlobalPoint | LocalPoint> = [a: P, b: P] & {
69
+ _brand: "excalimath__rectangle";
70
+ };
65
71
  /**
66
72
  * A polygon is a closed shape by connecting the given points
67
73
  * rectangles and diamonds are modelled by polygons
@@ -86,11 +92,14 @@ export type PolarCoords = [
86
92
  angle: number
87
93
  ];
88
94
  /**
89
- * Angles are in radians and centered on 0, 0. Zero radians on a 1 radius circle
90
- * corresponds to (1, 0) cartesian coordinates (point), i.e. to the "right".
95
+ An ellipse is specified by its center, angle, and its major and minor axes
96
+ but for the sake of simplicity, we've used halfWidth and halfHeight instead
97
+ in replace of semi major and semi minor axes
91
98
  */
92
- export type SymmetricArc = {
93
- radius: number;
94
- startAngle: number;
95
- endAngle: number;
99
+ export type Ellipse<Point extends GlobalPoint | LocalPoint> = {
100
+ center: Point;
101
+ halfWidth: number;
102
+ halfHeight: number;
103
+ } & {
104
+ _brand: "excalimath_ellipse";
96
105
  };
@@ -86,7 +86,3 @@ export declare function vectorMagnitude(v: Vector): number;
86
86
  * @returns The new normalized vector
87
87
  */
88
88
  export declare const vectorNormalize: (v: Vector) => Vector;
89
- /**
90
- * Project the first vector onto the second vector
91
- */
92
- export declare const vectorProjection: (a: Vector, b: Vector) => Vector;
@@ -1,5 +1,5 @@
1
+ import type { ExportToCanvasConfig, ExportToCanvasData } from "@excalidraw/excalidraw/scene/export";
1
2
  import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
2
- import type { ExportToCanvasConfig, ExportToCanvasData } from "../excalidraw/scene/export";
3
3
  export { MIME_TYPES };
4
4
  type ExportToBlobConfig = ExportToCanvasConfig & {
5
5
  mimeType?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwelle/excalidraw",
3
- "version": "0.6.0-rc.1",
3
+ "version": "0.6.0-rc.3",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -48,8 +48,8 @@
48
48
  ]
49
49
  },
50
50
  "peerDependencies": {
51
- "react": "^17.0.2 || ^18.2.0",
52
- "react-dom": "^17.0.2 || ^18.2.0"
51
+ "react": "^17.0.2 || ^18.2.0 || ^19.0.0",
52
+ "react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "@braintree/sanitize-url": "6.0.2",
@@ -85,25 +85,16 @@
85
85
  "tunnel-rat": "0.1.2"
86
86
  },
87
87
  "devDependencies": {
88
- "@babel/core": "7.24.5",
89
- "@babel/plugin-transform-arrow-functions": "7.24.1",
90
- "@babel/plugin-transform-async-to-generator": "7.24.1",
91
- "@babel/plugin-transform-runtime": "7.24.3",
92
- "@babel/plugin-transform-typescript": "7.24.5",
93
- "@babel/preset-env": "7.24.5",
94
- "@babel/preset-react": "7.24.1",
95
- "@babel/preset-typescript": "7.24.1",
96
88
  "@size-limit/preset-big-lib": "9.0.0",
97
89
  "@testing-library/dom": "10.4.0",
98
- "@testing-library/jest-dom": "5.16.2",
99
- "@testing-library/react": "16.0.0",
90
+ "@testing-library/jest-dom": "6.6.3",
91
+ "@testing-library/react": "16.2.0",
100
92
  "@types/lodash.debounce": "4.0.8",
101
93
  "@types/pako": "2.0.3",
102
94
  "@types/pica": "5.1.3",
103
95
  "@types/resize-observer-browser": "0.1.7",
104
96
  "ansicolor": "2.0.3",
105
97
  "autoprefixer": "10.4.7",
106
- "babel-plugin-transform-class-properties": "6.24.1",
107
98
  "cross-env": "7.0.3",
108
99
  "dotenv": "16.0.1",
109
100
  "esbuild": "0.19.10",
@@ -115,6 +106,7 @@
115
106
  "jest-diff": "29.7.0",
116
107
  "typescript": "4.9.4"
117
108
  },
109
+ "repository": "https://github.com/excalidraw/excalidraw",
118
110
  "bugs": "https://github.com/excalidraw/excalidraw/issues",
119
111
  "homepage": "https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw",
120
112
  "repository": "https://github.com/dwelle/excalidraw",