@excalidraw/excalidraw 0.18.0-a30e1b2 → 0.18.0-a8acc82

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 (175) hide show
  1. package/dist/dev/chunk-6MX365WZ.js +5666 -0
  2. package/dist/dev/chunk-6MX365WZ.js.map +7 -0
  3. package/dist/dev/chunk-CP5DND7P.js +7 -0
  4. package/dist/dev/chunk-CP5DND7P.js.map +7 -0
  5. package/dist/dev/{chunk-CARD3WJZ.js → chunk-QF5FRM6O.js} +7 -2
  6. package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
  7. package/dist/dev/data/{image-AYLHSOBV.js → image-GQCFJKGM.js} +3 -3
  8. package/dist/dev/index.css +187 -21
  9. package/dist/dev/index.css.map +3 -3
  10. package/dist/dev/index.js +15073 -16288
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-E3O5XSXJ.js → en-SMAPCEOQ.js} +2 -2
  13. package/dist/dev/subset-shared.chunk.js +1 -1
  14. package/dist/dev/subset-worker.chunk.js +1 -1
  15. package/dist/prod/chunk-A66AFZZU.js +7 -0
  16. package/dist/prod/chunk-I4UNSFV6.js +12 -0
  17. package/dist/prod/chunk-R2M7VUMD.js +4 -0
  18. package/dist/prod/data/image-JWK7QZ22.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +27 -20
  21. package/dist/prod/locales/{en-44IKVKYT.js → en-TYY6KWIJ.js} +1 -1
  22. package/dist/prod/subset-shared.chunk.js +1 -1
  23. package/dist/prod/subset-worker.chunk.js +1 -1
  24. package/dist/types/common/src/constants.d.ts +38 -7
  25. package/dist/types/common/src/utils.d.ts +7 -5
  26. package/dist/types/element/src/Scene.d.ts +10 -6
  27. package/dist/types/element/src/align.d.ts +3 -2
  28. package/dist/types/element/src/binding.d.ts +11 -8
  29. package/dist/types/element/src/bounds.d.ts +12 -4
  30. package/dist/types/element/src/collision.d.ts +18 -12
  31. package/dist/types/element/src/cropElement.d.ts +1 -1
  32. package/dist/types/element/src/delta.d.ts +41 -9
  33. package/dist/types/element/src/distance.d.ts +2 -2
  34. package/dist/types/element/src/distribute.d.ts +2 -1
  35. package/dist/types/element/src/dragElements.d.ts +1 -1
  36. package/dist/types/element/src/flowchart.d.ts +1 -1
  37. package/dist/types/element/src/fractionalIndex.d.ts +8 -2
  38. package/dist/types/element/src/frame.d.ts +2 -2
  39. package/dist/types/element/src/groups.d.ts +1 -0
  40. package/dist/types/element/src/index.d.ts +42 -0
  41. package/dist/types/element/src/linearElementEditor.d.ts +15 -24
  42. package/dist/types/element/src/mutateElement.d.ts +1 -1
  43. package/dist/types/element/src/newElement.d.ts +3 -2
  44. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  45. package/dist/types/element/src/renderElement.d.ts +4 -1
  46. package/dist/types/element/src/resizeElements.d.ts +2 -1
  47. package/dist/types/element/src/selection.d.ts +0 -5
  48. package/dist/types/element/src/shape.d.ts +42 -0
  49. package/dist/types/element/src/sizeHelpers.d.ts +2 -1
  50. package/dist/types/element/src/store.d.ts +19 -9
  51. package/dist/types/element/src/textElement.d.ts +2 -2
  52. package/dist/types/element/src/transformHandles.d.ts +2 -2
  53. package/dist/types/element/src/typeChecks.d.ts +16 -1
  54. package/dist/types/element/src/types.d.ts +10 -4
  55. package/dist/types/element/src/utils.d.ts +16 -6
  56. package/dist/types/element/src/zindex.d.ts +3 -3
  57. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +24 -15
  58. package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
  59. package/dist/types/excalidraw/actions/actionBoundText.d.ts +16 -10
  60. package/dist/types/excalidraw/actions/actionCanvas.d.ts +134 -94
  61. package/dist/types/excalidraw/actions/actionClipboard.d.ts +53 -33
  62. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +8 -5
  63. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +27 -17
  64. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
  65. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  66. package/dist/types/excalidraw/actions/actionElementLink.d.ts +8 -5
  67. package/dist/types/excalidraw/actions/actionElementLock.d.ts +31 -26
  68. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +8 -5
  69. package/dist/types/excalidraw/actions/actionExport.d.ts +94 -67
  70. package/dist/types/excalidraw/actions/actionFinalize.d.ts +66 -19
  71. package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
  72. package/dist/types/excalidraw/actions/actionFrame.d.ts +81 -69
  73. package/dist/types/excalidraw/actions/actionGroup.d.ts +20 -14
  74. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +534 -7
  75. package/dist/types/excalidraw/actions/actionLink.d.ts +10 -7
  76. package/dist/types/excalidraw/actions/actionMenu.d.ts +26 -17
  77. package/dist/types/excalidraw/actions/actionNavigate.d.ts +16 -10
  78. package/dist/types/excalidraw/actions/actionProperties.d.ts +145 -83
  79. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +10 -7
  80. package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -9
  81. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -7
  82. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -7
  83. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -7
  84. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -7
  85. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -7
  86. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -7
  87. package/dist/types/excalidraw/actions/actionZindex.d.ts +10 -10
  88. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  89. package/dist/types/excalidraw/actions/types.d.ts +3 -2
  90. package/dist/types/excalidraw/appState.d.ts +20 -10
  91. package/dist/types/excalidraw/clipboard.d.ts +64 -1
  92. package/dist/types/excalidraw/components/Actions.d.ts +8 -5
  93. package/dist/types/excalidraw/components/App.d.ts +22 -21
  94. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  95. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  96. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +7 -2
  97. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  98. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
  99. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
  100. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
  101. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  102. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  103. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  104. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -28
  105. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  106. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  107. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  108. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +2 -1
  109. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  110. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  111. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  112. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  113. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  114. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  115. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  116. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  117. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  118. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  119. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  120. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  121. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  122. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  123. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  124. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  125. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  126. package/dist/types/excalidraw/components/icons.d.ts +9 -0
  127. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  128. package/dist/types/excalidraw/data/blob.d.ts +3 -7
  129. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  130. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  131. package/dist/types/excalidraw/data/transform.d.ts +1 -1
  132. package/dist/types/excalidraw/data/types.d.ts +4 -1
  133. package/dist/types/excalidraw/eraser/index.d.ts +0 -2
  134. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  135. package/dist/types/excalidraw/history.d.ts +21 -5
  136. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  137. package/dist/types/excalidraw/index.d.ts +11 -10
  138. package/dist/types/excalidraw/lasso/index.d.ts +1 -0
  139. package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
  140. package/dist/types/excalidraw/renderer/helpers.d.ts +4 -4
  141. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  142. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
  143. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  144. package/dist/types/excalidraw/snapping.d.ts +2 -2
  145. package/dist/types/excalidraw/types.d.ts +24 -13
  146. package/dist/types/math/src/angle.d.ts +2 -0
  147. package/dist/types/math/src/constants.d.ts +3 -0
  148. package/dist/types/math/src/curve.d.ts +32 -0
  149. package/dist/types/math/src/index.d.ts +1 -0
  150. package/dist/types/math/src/point.d.ts +1 -1
  151. package/dist/types/math/src/rectangle.d.ts +2 -0
  152. package/dist/types/math/src/segment.d.ts +1 -0
  153. package/dist/types/math/src/vector.d.ts +4 -2
  154. package/dist/types/utils/src/bbox.d.ts +1 -1
  155. package/dist/types/utils/src/index.d.ts +1 -1
  156. package/dist/types/utils/src/withinBounds.d.ts +1 -1
  157. package/history.ts +108 -45
  158. package/package.json +13 -10
  159. package/dist/dev/chunk-CARD3WJZ.js.map +0 -7
  160. package/dist/dev/chunk-ETWEPOFC.js +0 -18701
  161. package/dist/dev/chunk-ETWEPOFC.js.map +0 -7
  162. package/dist/dev/chunk-RS23HYC4.js +0 -7
  163. package/dist/dev/chunk-RS23HYC4.js.map +0 -7
  164. package/dist/prod/chunk-6BSJPDKJ.js +0 -33
  165. package/dist/prod/chunk-FGHASORR.js +0 -12
  166. package/dist/prod/chunk-SBKTMZM7.js +0 -7
  167. package/dist/prod/data/image-VAYKYPXV.js +0 -1
  168. package/dist/types/element/src/Shape.d.ts +0 -17
  169. package/dist/types/element/src/ShapeCache.d.ts +0 -25
  170. package/dist/types/element/src/shapes.d.ts +0 -23
  171. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  172. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  173. package/dist/types/utils/src/collision.d.ts +0 -8
  174. /package/dist/dev/data/{image-AYLHSOBV.js.map → image-GQCFJKGM.js.map} +0 -0
  175. /package/dist/dev/locales/{en-E3O5XSXJ.js.map → en-SMAPCEOQ.js.map} +0 -0
@@ -14,3 +14,45 @@ export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element:
14
14
  export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
15
15
  export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
16
16
  export declare const clearElementsForLocalStorage: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
17
+ export * from "./align";
18
+ export * from "./binding";
19
+ export * from "./bounds";
20
+ export * from "./collision";
21
+ export * from "./comparisons";
22
+ export * from "./containerCache";
23
+ export * from "./cropElement";
24
+ export * from "./delta";
25
+ export * from "./distance";
26
+ export * from "./distribute";
27
+ export * from "./dragElements";
28
+ export * from "./duplicate";
29
+ export * from "./elbowArrow";
30
+ export * from "./elementLink";
31
+ export * from "./embeddable";
32
+ export * from "./flowchart";
33
+ export * from "./fractionalIndex";
34
+ export * from "./frame";
35
+ export * from "./groups";
36
+ export * from "./heading";
37
+ export * from "./image";
38
+ export * from "./linearElementEditor";
39
+ export * from "./mutateElement";
40
+ export * from "./newElement";
41
+ export * from "./positionElementsOnGrid";
42
+ export * from "./renderElement";
43
+ export * from "./resizeElements";
44
+ export * from "./resizeTest";
45
+ export * from "./Scene";
46
+ export * from "./selection";
47
+ export * from "./shape";
48
+ export * from "./showSelectedShapeActions";
49
+ export * from "./sizeHelpers";
50
+ export * from "./sortElements";
51
+ export * from "./store";
52
+ export * from "./textElement";
53
+ export * from "./textMeasurements";
54
+ export * from "./textWrapping";
55
+ export * from "./transformHandles";
56
+ export * from "./typeChecks";
57
+ export * from "./utils";
58
+ export * from "./zindex";
@@ -1,15 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
3
- import type { Store } from "@excalidraw/element/store";
3
+ import { type Store } from "@excalidraw/element";
4
4
  import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize, Zoom } from "@excalidraw/excalidraw/types";
5
- import type Scene from "./Scene";
5
+ import type { Scene } from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
7
  import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, PointsPositionUpdates } from "./types";
8
- declare const editorMidPointsCache: {
9
- version: number | null;
10
- points: (GlobalPoint | null)[];
11
- zoom: number | null;
12
- };
13
8
  export declare class LinearElementEditor {
14
9
  readonly elementId: ExcalidrawElement["id"] & {
15
10
  _brand: "excalidrawLinearElementId";
@@ -43,7 +38,9 @@ export declare class LinearElementEditor {
43
38
  readonly hoverPointIndex: number;
44
39
  readonly segmentMidPointHoveredCoords: GlobalPoint | null;
45
40
  readonly elbowed: boolean;
46
- constructor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap);
41
+ readonly customLineAngle: number | null;
42
+ readonly isEditing: boolean;
43
+ constructor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, isEditing?: boolean);
47
44
  static POINT_HANDLE_SIZE: number;
48
45
  /**
49
46
  * @param id the `elementId` from the instance of this class (so that we can
@@ -54,19 +51,15 @@ export declare class LinearElementEditor {
54
51
  /**
55
52
  * @returns whether point was dragged
56
53
  */
57
- static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>, pointSceneCoords: {
58
- x: number;
59
- y: number;
60
- }[]) => void, linearElementEditor: LinearElementEditor, scene: Scene): LinearElementEditor | null;
54
+ static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, keyof AppState> | null;
61
55
  static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, scene: Scene): LinearElementEditor;
62
- static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
63
- static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => void;
56
+ static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (GlobalPoint | null)[];
64
57
  static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
65
58
  x: number;
66
59
  y: number;
67
60
  }, appState: AppState, elementsMap: ElementsMap) => GlobalPoint | null;
68
61
  static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, startPoint: P, endPoint: P, index: number, zoom: Zoom): boolean;
69
- static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: GlobalPoint, endPoint: GlobalPoint, endPointIndex: number, elementsMap: ElementsMap): GlobalPoint;
62
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, index: number): GlobalPoint;
70
63
  static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: GlobalPoint, elementsMap: ElementsMap): number;
71
64
  static handlePointerDown(event: React.PointerEvent<HTMLElement>, app: AppClassProperties, store: Store, scenePointer: {
72
65
  x: number;
@@ -89,20 +82,19 @@ export declare class LinearElementEditor {
89
82
  static createPointAt(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, scenePointerX: number, scenePointerY: number, gridSize: NullableGridSize): LocalPoint;
90
83
  /**
91
84
  * Normalizes line points so that the start point is at [0,0]. This is
92
- * expected in various parts of the codebase. Also returns new x/y to account
93
- * for the potential normalization.
85
+ * expected in various parts of the codebase.
86
+ *
87
+ * Also returns normalized x and y coords to account for the normalization
88
+ * of the points.
94
89
  */
95
- static getNormalizedPoints(element: ExcalidrawLinearElement): {
90
+ static getNormalizeElementPointsAndCoords(element: ExcalidrawLinearElement): {
96
91
  points: LocalPoint[];
97
92
  x: number;
98
93
  y: number;
99
94
  };
100
- static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap): void;
101
95
  static duplicateSelectedPoints(appState: AppState, scene: Scene): AppState;
102
- static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, pointIndices: readonly number[]): void;
103
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, targetPoints: {
104
- point: LocalPoint;
105
- }[]): void;
96
+ static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, app: AppClassProperties, pointIndices: readonly number[]): void;
97
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, addedPoints: LocalPoint[]): void;
106
98
  static movePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, pointUpdates: PointsPositionUpdates, otherUpdates?: {
107
99
  startBinding?: PointBinding | null;
108
100
  endBinding?: PointBinding | null;
@@ -123,4 +115,3 @@ export declare class LinearElementEditor {
123
115
  static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, scene: Scene): LinearElementEditor;
124
116
  static deleteFixedSegment(element: ExcalidrawElbowArrowElement, scene: Scene, index: number): void;
125
117
  }
126
- export {};
@@ -1,6 +1,6 @@
1
1
  import type { Mutable } from "@excalidraw/common/utility-types";
2
2
  import type { ElementsMap, ExcalidrawElement } from "./types";
3
- export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
3
+ export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "updated">;
4
4
  /**
5
5
  * This function tracks updates of text elements for the purposes for collaboration.
6
6
  * The version is used to compare updates when more than one user is working in
@@ -1,5 +1,5 @@
1
1
  import type { MarkOptional } from "@excalidraw/common/utility-types";
2
- import type { ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, ExcalidrawElbowArrowElement } from "./types";
2
+ import type { ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement } from "./types";
3
3
  export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
4
4
  export declare const newElement: (opts: {
5
5
  type: ExcalidrawGenericElement["type"];
@@ -43,6 +43,7 @@ export declare const newFreeDrawElement: (opts: {
43
43
  export declare const newLinearElement: (opts: {
44
44
  type: ExcalidrawLinearElement["type"];
45
45
  points?: ExcalidrawLinearElement["points"];
46
+ polygon?: ExcalidrawLineElement["polygon"];
46
47
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
47
48
  export declare const newArrowElement: <T extends boolean>(opts: {
48
49
  type: ExcalidrawArrowElement["type"];
@@ -51,7 +52,7 @@ export declare const newArrowElement: <T extends boolean>(opts: {
51
52
  points?: readonly import("@excalidraw/math").LocalPoint[] | undefined;
52
53
  elbowed?: T | undefined;
53
54
  fixedSegments?: readonly import("./types").FixedSegment[] | null | undefined;
54
- } & Omit<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "link" | "angle" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData"> & Partial<Pick<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "link" | "angle" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData">>) => T extends true ? NonDeleted<ExcalidrawElbowArrowElement> : NonDeleted<ExcalidrawArrowElement>;
55
+ } & Omit<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "link" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "angle" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData"> & Partial<Pick<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "link" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "angle" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData">>) => T extends true ? NonDeleted<ExcalidrawElbowArrowElement> : NonDeleted<ExcalidrawArrowElement>;
55
56
  export declare const newImageElement: (opts: {
56
57
  type: ExcalidrawImageElement["type"];
57
58
  status?: ExcalidrawImageElement["status"];
@@ -0,0 +1,2 @@
1
+ import type { ExcalidrawElement } from "./types";
2
+ export declare const positionElementsOnGrid: <TElement extends ExcalidrawElement>(elements: TElement[] | TElement[][], centerX: number, centerY: number, padding?: number) => TElement[];
@@ -1,6 +1,7 @@
1
+ import { type GlobalPoint } from "@excalidraw/math";
1
2
  import type { AppState, StaticCanvasAppState, InteractiveCanvasAppState, ElementsPendingErasure, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
2
3
  import type { StaticCanvasRenderConfig, RenderableElementsMap, InteractiveCanvasRenderConfig } from "@excalidraw/excalidraw/scene/types";
3
- import type { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawImageElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap } from "./types";
4
+ import type { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawImageElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap, ElementsMap } from "./types";
4
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
5
6
  export declare const IMAGE_INVERT_FILTER = "invert(100%) hue-rotate(180deg) saturate(1.25)";
6
7
  export declare const getRenderOpacity: (element: ExcalidrawElement, containingFrame: ExcalidrawFrameLikeElement | null, elementsPendingErasure: ElementsPendingErasure, pendingNodes: Readonly<PendingExcalidrawElements> | null, globalAlpha?: number) => number;
@@ -26,3 +27,5 @@ export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
26
27
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
27
28
  export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
28
29
  export declare function getFreeDrawSvgPath(element: ExcalidrawFreeDrawElement): string;
30
+ export declare function getFreedrawOutlineAsSegments(element: ExcalidrawFreeDrawElement, points: [number, number][], elementsMap: ElementsMap): import("@excalidraw/math").LineSegment<GlobalPoint>[];
31
+ export declare function getFreedrawOutlinePoints(element: ExcalidrawFreeDrawElement): [number, number][];
@@ -1,6 +1,6 @@
1
1
  import { type LocalPoint } from "@excalidraw/math";
2
2
  import type { PointerDownState } from "@excalidraw/excalidraw/types";
3
- import type Scene from "./Scene";
3
+ import type { Scene } from "./Scene";
4
4
  import type { BoundingBox } from "./bounds";
5
5
  import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
6
6
  import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap } from "./types";
@@ -13,6 +13,7 @@ export declare const rescalePointsInElement: (element: NonDeletedExcalidrawEleme
13
13
  export declare const measureFontSizeFromWidth: (element: NonDeleted<ExcalidrawTextElement>, elementsMap: ElementsMap, nextWidth: number) => {
14
14
  size: number;
15
15
  } | null;
16
+ export declare const resizeSingleTextElement: (origElement: NonDeleted<ExcalidrawTextElement>, element: NonDeleted<ExcalidrawTextElement>, scene: Scene, transformHandleType: TransformHandleDirection, shouldResizeFromCenter: boolean, nextWidth: number, nextHeight: number) => void;
16
17
  export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
17
18
  export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
18
19
  export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, originalElementsMap: ElementsMap, scene: Scene, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
@@ -14,11 +14,6 @@ export declare const isSomeElementSelected: {
14
14
  (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">): boolean;
15
15
  clearCache(): void;
16
16
  };
17
- /**
18
- * Returns common attribute (picked by `getAttribute` callback) of selected
19
- * elements. If elements don't share the same value, returns `null`.
20
- */
21
- export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, getAttribute: (element: ExcalidrawElement) => T) => T | null;
22
17
  export declare const getSelectedElements: (elements: ElementsMapOrArray, appState: Pick<InteractiveCanvasAppState, "selectedElementIds">, opts?: {
23
18
  includeBoundTextElement?: boolean;
24
19
  includeElementsInFrames?: boolean;
@@ -0,0 +1,42 @@
1
+ import { type GeometricShape } from "@excalidraw/utils/shape";
2
+ import { type LocalPoint } from "@excalidraw/math";
3
+ import type { GlobalPoint } from "@excalidraw/math";
4
+ import type { AppState, EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
5
+ import type { ElementShape, ElementShapes } from "@excalidraw/excalidraw/scene/types";
6
+ import type { ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawFreeDrawElement, ElementsMap, ExcalidrawLineElement } from "./types";
7
+ import type { Drawable, Options } from "roughjs/bin/core";
8
+ export declare class ShapeCache {
9
+ private static rg;
10
+ private static cache;
11
+ /**
12
+ * Retrieves shape from cache if available. Use this only if shape
13
+ * is optional and you have a fallback in case it's not cached.
14
+ */
15
+ static get: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined;
16
+ static set: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
17
+ static delete: (element: ExcalidrawElement) => boolean;
18
+ static destroy: () => void;
19
+ /**
20
+ * Generates & caches shape for element if not already cached, otherwise
21
+ * returns cached shape.
22
+ */
23
+ static generateElementShape: <T extends ExcalidrawLinearElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | ExcalidrawFreeDrawElement | import("./types").ExcalidrawArrowElement>(element: T, renderConfig: {
24
+ isExporting: boolean;
25
+ canvasBackgroundColor: AppState["viewBackgroundColor"];
26
+ embedsValidationStatus: EmbedsValidationStatus;
27
+ } | null) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
28
+ }
29
+ export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
30
+ export declare const generateLinearCollisionShape: (element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement) => {
31
+ op: string;
32
+ data: number[];
33
+ }[];
34
+ /**
35
+ * get the pure geometric shape of an excalidraw elementw
36
+ * which is then used for hit detection
37
+ */
38
+ export declare const getElementShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point>;
39
+ export declare const toggleLinePolygonState: (element: ExcalidrawLineElement, nextPolygonState: boolean) => {
40
+ polygon: ExcalidrawLineElement["polygon"];
41
+ points: ExcalidrawLineElement["points"];
42
+ } | null;
@@ -1,5 +1,6 @@
1
1
  import type { AppState, Offsets, Zoom } from "@excalidraw/excalidraw/types";
2
2
  import type { ElementsMap, ExcalidrawElement } from "./types";
3
+ export declare const INVISIBLY_SMALL_ELEMENT_SIZE = 0.1;
3
4
  export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
4
5
  export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
5
6
  zoom: Zoom;
@@ -22,7 +23,7 @@ export declare const getPerfectElementSize: (elementType: AppState["activeTool"]
22
23
  width: number;
23
24
  height: number;
24
25
  };
25
- export declare const getLockedLinearCursorAlignSize: (originX: number, originY: number, x: number, y: number) => {
26
+ export declare const getLockedLinearCursorAlignSize: (originX: number, originY: number, x: number, y: number, customAngle?: number) => {
26
27
  width: number;
27
28
  height: number;
28
29
  };
@@ -3,7 +3,8 @@ import type App from "@excalidraw/excalidraw/components/App";
3
3
  import type { DTO, ValueOf } from "@excalidraw/common/utility-types";
4
4
  import type { AppState, ObservedAppState } from "@excalidraw/excalidraw/types";
5
5
  import { ElementsDelta, AppStateDelta } from "./delta";
6
- import type { OrderedExcalidrawElement, SceneElementsMap } from "./types";
6
+ import type { ApplyToOptions } from "./delta";
7
+ import type { ExcalidrawElement, OrderedExcalidrawElement, SceneElementsMap } from "./types";
7
8
  export declare const CaptureUpdateAction: {
8
9
  /**
9
10
  * Immediately undoable.
@@ -60,7 +61,7 @@ export declare class Store {
60
61
  */
61
62
  scheduleMicroAction(params: {
62
63
  action: CaptureUpdateActionType;
63
- elements: SceneElementsMap | undefined;
64
+ elements: readonly ExcalidrawElement[] | undefined;
64
65
  appState: AppState | ObservedAppState | undefined;
65
66
  } | {
66
67
  action: typeof CaptureUpdateAction.IMMEDIATELY;
@@ -157,6 +158,10 @@ export declare class StoreDelta {
157
158
  static create(elements: ElementsDelta, appState: AppStateDelta, opts?: {
158
159
  id: string;
159
160
  }): StoreDelta;
161
+ /**
162
+ * Calculate the delta between the previous and next snapshot.
163
+ */
164
+ static calculate(prevSnapshot: StoreSnapshot, nextSnapshot: StoreSnapshot): StoreDelta;
160
165
  /**
161
166
  * Restore a store delta instance from a DTO.
162
167
  */
@@ -164,19 +169,24 @@ export declare class StoreDelta {
164
169
  /**
165
170
  * Parse and load the delta from the remote payload.
166
171
  */
167
- static load({ id, elements: { added, removed, updated }, }: DTO<StoreDelta>): StoreDelta;
172
+ static load({ id, elements: { added, removed, updated }, appState: { delta: appStateDelta }, }: DTO<StoreDelta>): StoreDelta;
173
+ /**
174
+ * Squash the passed deltas into the aggregated delta instance.
175
+ */
176
+ static squash(...deltas: StoreDelta[]): StoreDelta;
168
177
  /**
169
178
  * Inverse store delta, creates new instance of `StoreDelta`.
170
179
  */
171
180
  static inverse(delta: StoreDelta): StoreDelta;
172
181
  /**
173
- * Apply latest (remote) changes to the delta, creates new instance of `StoreDelta`.
182
+ * Apply the delta to the passed elements and appState, does not modify the snapshot.
174
183
  */
175
- static applyLatestChanges(delta: StoreDelta, elements: SceneElementsMap, modifierOptions: "deleted" | "inserted"): StoreDelta;
184
+ static applyTo(delta: StoreDelta, elements: SceneElementsMap, appState: AppState, options?: ApplyToOptions): [SceneElementsMap, AppState, boolean];
176
185
  /**
177
- * Apply the delta to the passed elements and appState, does not modify the snapshot.
186
+ * Apply latest (remote) changes to the delta, creates new instance of `StoreDelta`.
178
187
  */
179
- static applyTo(delta: StoreDelta, elements: SceneElementsMap, appState: AppState, prevSnapshot?: StoreSnapshot): [SceneElementsMap, AppState, boolean];
188
+ static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): StoreDelta;
189
+ static empty(): StoreDelta;
180
190
  isEmpty(): boolean;
181
191
  }
182
192
  /**
@@ -216,7 +226,7 @@ export declare class StoreSnapshot {
216
226
  private maybeCreateElementsSnapshot;
217
227
  private detectChangedAppState;
218
228
  /**
219
- * Detect if there any changed elements.
229
+ * Detect if there are any changed elements.
220
230
  */
221
231
  private detectChangedElements;
222
232
  /**
@@ -224,4 +234,4 @@ export declare class StoreSnapshot {
224
234
  */
225
235
  private createElementsSnapshot;
226
236
  }
227
- export declare const getObservedAppState: (appState: AppState) => ObservedAppState;
237
+ export declare const getObservedAppState: (appState: AppState | ObservedAppState) => ObservedAppState;
@@ -1,7 +1,7 @@
1
+ import { type Radians } from "@excalidraw/math";
1
2
  import type { AppState } from "@excalidraw/excalidraw/types";
2
3
  import type { ExtractSetType } from "@excalidraw/common/utility-types";
3
- import type { Radians } from "@excalidraw/math";
4
- import type Scene from "./Scene";
4
+ import type { Scene } from "./Scene";
5
5
  import type { MaybeTransformHandleType } from "./transformHandles";
6
6
  import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeletedExcalidrawElement } from "./types";
7
7
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
@@ -31,8 +31,8 @@ export declare const OMIT_SIDES_FOR_FRAME: {
31
31
  export declare const canResizeFromSides: (device: Device) => boolean;
32
32
  export declare const getOmitSidesForDevice: (device: Device) => {};
33
33
  export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: Radians, zoom: Zoom, pointerType: PointerType, omitSides?: {
34
- n?: boolean | undefined;
35
34
  s?: boolean | undefined;
35
+ n?: boolean | undefined;
36
36
  w?: boolean | undefined;
37
37
  e?: boolean | undefined;
38
38
  nw?: boolean | undefined;
@@ -42,8 +42,8 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
42
42
  rotation?: boolean | undefined;
43
43
  }, margin?: number, spacing?: number) => TransformHandles;
44
44
  export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType, omitSides?: {
45
- n?: boolean | undefined;
46
45
  s?: boolean | undefined;
46
+ n?: boolean | undefined;
47
47
  w?: boolean | undefined;
48
48
  e?: boolean | undefined;
49
49
  nw?: boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
2
  import type { MarkNonNullable } from "@excalidraw/common/utility-types";
3
3
  import type { Bounds } from "./bounds";
4
- import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, PointBinding, FixedPointBinding, ExcalidrawFlowchartNodeElement } from "./types";
4
+ import type { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement, ExcalidrawArrowElement, ExcalidrawElbowArrowElement, ExcalidrawLineElement, PointBinding, FixedPointBinding, ExcalidrawFlowchartNodeElement, ExcalidrawLinearElementSubType } from "./types";
5
5
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
6
6
  export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
7
7
  export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
@@ -14,8 +14,13 @@ export declare const isFrameLikeElement: (element: ExcalidrawElement | null) =>
14
14
  export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
15
15
  export declare const isFreeDrawElementType: (elementType: ExcalidrawElementType) => boolean;
16
16
  export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
17
+ export declare const isLineElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLineElement;
17
18
  export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawArrowElement;
18
19
  export declare const isElbowArrow: (element?: ExcalidrawElement) => element is ExcalidrawElbowArrowElement;
20
+ /**
21
+ * sharp or curved arrow, but not elbow
22
+ */
23
+ export declare const isSimpleArrow: (element?: ExcalidrawElement) => element is ExcalidrawArrowElement;
19
24
  export declare const isSharpArrow: (element?: ExcalidrawElement) => element is ExcalidrawArrowElement;
20
25
  export declare const isCurvedArrow: (element?: ExcalidrawElement) => element is ExcalidrawArrowElement;
21
26
  export declare const isLinearElementType: (elementType: ElementOrToolType) => boolean;
@@ -40,3 +45,13 @@ export declare const getDefaultRoundnessTypeForElement: (element: ExcalidrawElem
40
45
  } | null;
41
46
  export declare const isFixedPointBinding: (binding: PointBinding | FixedPointBinding) => binding is FixedPointBinding;
42
47
  export declare const isBounds: (box: unknown) => box is Bounds;
48
+ export declare const getLinearElementSubType: (element: ExcalidrawLinearElement) => ExcalidrawLinearElementSubType;
49
+ /**
50
+ * Checks if current element points meet all the conditions for polygon=true
51
+ * (this isn't a element type check, for that use isLineElement).
52
+ *
53
+ * If you want to check if points *can* be turned into a polygon, use
54
+ * canBecomePolygon(points).
55
+ */
56
+ export declare const isValidPolygon: (points: ExcalidrawLineElement["points"]) => boolean;
57
+ export declare const canBecomePolygon: (points: ExcalidrawLineElement["points"]) => boolean;
@@ -151,7 +151,7 @@ export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagi
151
151
  */
152
152
  export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
153
153
  export type ExcalidrawFlowchartNodeElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
154
- export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement;
154
+ export type ExcalidrawRectanguloidElement = ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawSelectionElement;
155
155
  /**
156
156
  * ExcalidrawElement should be JSON serializable and (eventually) contain
157
157
  * no computed data. The list of all ExcalidrawElements should be shareable
@@ -205,7 +205,8 @@ export type PointBinding = {
205
205
  export type FixedPointBinding = Merge<PointBinding, {
206
206
  fixedPoint: FixedPoint;
207
207
  }>;
208
- export type PointsPositionUpdates = Map<number, {
208
+ type Index = number;
209
+ export type PointsPositionUpdates = Map<Index, {
209
210
  point: LocalPoint;
210
211
  isDragging?: boolean;
211
212
  }>;
@@ -219,10 +220,14 @@ export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
219
220
  startArrowhead: Arrowhead | null;
220
221
  endArrowhead: Arrowhead | null;
221
222
  }>;
223
+ export type ExcalidrawLineElement = ExcalidrawLinearElement & Readonly<{
224
+ type: "line";
225
+ polygon: boolean;
226
+ }>;
222
227
  export type FixedSegment = {
223
228
  start: LocalPoint;
224
229
  end: LocalPoint;
225
- index: number;
230
+ index: Index;
226
231
  };
227
232
  export type ExcalidrawArrowElement = ExcalidrawLinearElement & Readonly<{
228
233
  type: "arrow";
@@ -283,7 +288,8 @@ export type SceneElementsMap = Map<ExcalidrawElement["id"], Ordered<ExcalidrawEl
283
288
  */
284
289
  export type NonDeletedSceneElementsMap = Map<ExcalidrawElement["id"], Ordered<NonDeletedExcalidrawElement>> & MakeBrand<"NonDeletedSceneElementsMap">;
285
290
  export type ElementsMapOrArray = readonly ExcalidrawElement[] | Readonly<ElementsMap>;
291
+ export type ExcalidrawLinearElementSubType = "line" | "sharpArrow" | "curvedArrow" | "elbowArrow";
286
292
  export type ConvertibleGenericTypes = "rectangle" | "diamond" | "ellipse";
287
- export type ConvertibleLinearTypes = "line" | "sharpArrow" | "curvedArrow" | "elbowArrow";
293
+ export type ConvertibleLinearTypes = ExcalidrawLinearElementSubType;
288
294
  export type ConvertibleTypes = ConvertibleGenericTypes | ConvertibleLinearTypes;
289
295
  export {};
@@ -1,21 +1,31 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { Curve, LineSegment } from "@excalidraw/math";
3
- import type { ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "./types";
3
+ import type { Zoom } from "@excalidraw/excalidraw/types";
4
+ import type { ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, ExcalidrawRectanguloidElement } from "./types";
5
+ /**
6
+ * Returns the **rotated** components of freedraw, line or arrow elements.
7
+ *
8
+ * @param element The linear element to deconstruct
9
+ * @returns The rotated in components.
10
+ */
11
+ export declare function deconstructLinearOrFreeDrawElement(element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]];
4
12
  /**
5
13
  * Get the building components of a rectanguloid element in the form of
6
- * line segments and curves.
14
+ * line segments and curves **unrotated**.
7
15
  *
8
16
  * @param element Target rectanguloid element
9
17
  * @param offset Optional offset to expand the rectanguloid shape
10
- * @returns Tuple of line segments (0) and curves (1)
18
+ * @returns Tuple of **unrotated** line segments (0) and curves (1)
11
19
  */
12
20
  export declare function deconstructRectanguloidElement(element: ExcalidrawRectanguloidElement, offset?: number): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]];
13
21
  /**
14
- * Get the building components of a diamond element in the form of
15
- * line segments and curves as a tuple, in this order.
22
+ * Get the **unrotated** building components of a diamond element
23
+ * in the form of line segments and curves as a tuple, in this order.
16
24
  *
17
25
  * @param element The element to deconstruct
18
26
  * @param offset An optional offset
19
- * @returns Tuple of line segments (0) and curves (1)
27
+ * @returns Tuple of line **unrotated** segments (0) and curves (1)
20
28
  */
21
29
  export declare function deconstructDiamondElement(element: ExcalidrawDiamondElement, offset?: number): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]];
30
+ export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
31
+ export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
@@ -1,7 +1,7 @@
1
1
  import type { AppState } from "@excalidraw/excalidraw/types";
2
- import type Scene from "./Scene";
2
+ import type { Scene } from "./Scene";
3
3
  import type { ExcalidrawElement } from "./types";
4
4
  export declare const moveOneLeft: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
5
5
  export declare const moveOneRight: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
6
- export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[] | readonly ExcalidrawElement[];
7
- export declare const moveAllRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[] | readonly ExcalidrawElement[];
6
+ export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];
7
+ export declare const moveAllRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];