@myoc/excalidraw 0.18.16 → 0.18.18

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 (179) hide show
  1. package/dist/dev/{chunk-3HLOFB5F.js → chunk-MAGRVBVM.js} +13453 -10629
  2. package/dist/dev/chunk-MAGRVBVM.js.map +7 -0
  3. package/dist/dev/{chunk-PEI7EPYO.js → chunk-QO4EFL6B.js} +15 -5
  4. package/dist/dev/chunk-QO4EFL6B.js.map +7 -0
  5. package/dist/dev/chunk-WUH7JFG4.js +7 -0
  6. package/dist/dev/chunk-WUH7JFG4.js.map +7 -0
  7. package/dist/dev/data/{image-XPEIZ6XQ.js → image-BBHDGXQ3.js} +3 -3
  8. package/dist/dev/index.css +101 -24
  9. package/dist/dev/index.css.map +3 -3
  10. package/dist/dev/index.js +6587 -7610
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-R455UJTM.js → en-2WXBKZE2.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-4Z2WWUCC.js +7 -0
  16. package/dist/prod/chunk-KZXLT4YB.js +12 -0
  17. package/dist/prod/chunk-YBT3HBS6.js +33 -0
  18. package/dist/prod/data/image-JFILZTP3.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +18 -17
  21. package/dist/prod/locales/{en-YWERZJD6.js → en-XFR6MADM.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 +19 -2
  25. package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  26. package/dist/types/common/src/font-metadata.d.ts +4 -2
  27. package/dist/types/common/src/index.d.ts +1 -0
  28. package/dist/types/common/src/points.d.ts +1 -1
  29. package/dist/types/common/src/utility-types.d.ts +5 -0
  30. package/dist/types/common/src/utils.d.ts +17 -7
  31. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +11 -14
  32. package/dist/types/element/src/align.d.ts +3 -3
  33. package/dist/types/element/src/arrange.d.ts +2 -1
  34. package/dist/types/element/src/binding.d.ts +21 -14
  35. package/dist/types/element/src/bounds.d.ts +11 -5
  36. package/dist/types/element/src/collision.d.ts +18 -12
  37. package/dist/types/element/src/cropElement.d.ts +1 -1
  38. package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +63 -38
  39. package/dist/types/element/src/distance.d.ts +2 -2
  40. package/dist/types/element/src/dragElements.d.ts +3 -2
  41. package/dist/types/element/src/elbowArrow.d.ts +2 -2
  42. package/dist/types/element/src/flowchart.d.ts +3 -2
  43. package/dist/types/element/src/fractionalIndex.d.ts +9 -3
  44. package/dist/types/element/src/frame.d.ts +4 -3
  45. package/dist/types/element/src/heading.d.ts +2 -2
  46. package/dist/types/element/src/index.d.ts +43 -2
  47. package/dist/types/element/src/linearElementEditor.d.ts +21 -32
  48. package/dist/types/element/src/mutateElement.d.ts +11 -3
  49. package/dist/types/element/src/newElement.d.ts +4 -3
  50. package/dist/types/element/src/resizeElements.d.ts +5 -4
  51. package/dist/types/element/src/resizeTest.d.ts +2 -2
  52. package/dist/types/element/src/selection.d.ts +1 -6
  53. package/dist/types/element/src/shape.d.ts +42 -0
  54. package/dist/types/element/src/shapes.d.ts +10 -10
  55. package/dist/types/element/src/sizeHelpers.d.ts +2 -2
  56. package/dist/types/element/src/store.d.ts +231 -0
  57. package/dist/types/element/src/textElement.d.ts +4 -3
  58. package/dist/types/element/src/typeChecks.d.ts +19 -1
  59. package/dist/types/element/src/types.d.ts +15 -2
  60. package/dist/types/element/src/utils.d.ts +5 -1
  61. package/dist/types/element/src/zindex.d.ts +1 -1
  62. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +42 -51
  63. package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
  64. package/dist/types/excalidraw/actions/actionArrange.d.ts +2 -2
  65. package/dist/types/excalidraw/actions/actionBoundText.d.ts +28 -34
  66. package/dist/types/excalidraw/actions/actionCanvas.d.ts +187 -223
  67. package/dist/types/excalidraw/actions/actionClipboard.d.ts +87 -104
  68. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +14 -17
  69. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +41 -49
  70. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
  71. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  72. package/dist/types/excalidraw/actions/actionElementLink.d.ts +14 -17
  73. package/dist/types/excalidraw/actions/actionElementLock.d.ts +43 -50
  74. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +14 -17
  75. package/dist/types/excalidraw/actions/actionExport.d.ts +219 -246
  76. package/dist/types/excalidraw/actions/actionFinalize.d.ts +74 -40
  77. package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
  78. package/dist/types/excalidraw/actions/actionFrame.d.ts +100 -112
  79. package/dist/types/excalidraw/actions/actionGroup.d.ts +34 -40
  80. package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
  81. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +506 -16
  82. package/dist/types/excalidraw/actions/actionLink.d.ts +14 -17
  83. package/dist/types/excalidraw/actions/actionMenu.d.ts +42 -51
  84. package/dist/types/excalidraw/actions/actionNavigate.d.ts +27 -33
  85. package/dist/types/excalidraw/actions/actionProperties.d.ts +206 -243
  86. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +16 -19
  87. package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +2 -2
  88. package/dist/types/excalidraw/actions/actionStyles.d.ts +18 -21
  89. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -19
  90. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -19
  91. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -200
  92. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  93. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -19
  94. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +16 -19
  95. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -19
  96. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  97. package/dist/types/excalidraw/actions/types.d.ts +4 -3
  98. package/dist/types/excalidraw/appState.d.ts +40 -31
  99. package/dist/types/excalidraw/components/App.d.ts +15 -17
  100. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  101. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  102. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
  103. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  104. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
  105. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
  106. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
  107. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  108. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  109. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  110. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  111. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  112. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  113. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  114. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  115. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  116. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  117. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  118. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  119. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  120. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  121. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  122. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  123. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  124. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  125. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  126. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  127. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  128. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  129. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  130. package/dist/types/excalidraw/components/icons.d.ts +3 -0
  131. package/dist/types/excalidraw/components/shapes.d.ts +1 -1
  132. package/dist/types/excalidraw/data/blob.d.ts +1 -1
  133. package/dist/types/excalidraw/data/transform.d.ts +1 -1
  134. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  135. package/dist/types/excalidraw/eraser/index.d.ts +0 -2
  136. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  137. package/dist/types/excalidraw/history.d.ts +30 -22
  138. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  139. package/dist/types/excalidraw/index.d.ts +9 -9
  140. package/dist/types/excalidraw/lasso/index.d.ts +1 -0
  141. package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
  142. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
  143. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
  144. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  145. package/dist/types/excalidraw/snapping.d.ts +2 -2
  146. package/dist/types/excalidraw/types.d.ts +25 -10
  147. package/dist/types/excalidraw/visualdebug.d.ts +1 -1
  148. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  149. package/dist/types/math/src/angle.d.ts +3 -1
  150. package/dist/types/math/src/constants.d.ts +3 -0
  151. package/dist/types/math/src/curve.d.ts +34 -0
  152. package/dist/types/math/src/ellipse.d.ts +3 -3
  153. package/dist/types/math/src/index.d.ts +1 -0
  154. package/dist/types/math/src/point.d.ts +3 -3
  155. package/dist/types/math/src/polygon.d.ts +2 -2
  156. package/dist/types/math/src/segment.d.ts +5 -5
  157. package/dist/types/math/src/utils.d.ts +2 -0
  158. package/dist/types/math/src/vector.d.ts +8 -2
  159. package/dist/types/utils/src/bbox.d.ts +1 -1
  160. package/dist/types/utils/src/index.d.ts +1 -1
  161. package/dist/types/utils/src/shape.d.ts +12 -12
  162. package/dist/types/utils/src/withinBounds.d.ts +1 -1
  163. package/history.ts +147 -110
  164. package/package.json +4 -4
  165. package/dist/dev/chunk-3HLOFB5F.js.map +0 -7
  166. package/dist/dev/chunk-PEI7EPYO.js.map +0 -7
  167. package/dist/dev/chunk-QQGTICP4.js +0 -7
  168. package/dist/dev/chunk-QQGTICP4.js.map +0 -7
  169. package/dist/prod/chunk-7HNFGNL7.js +0 -7
  170. package/dist/prod/chunk-KKQVTSHB.js +0 -33
  171. package/dist/prod/chunk-KZWZ7WHC.js +0 -12
  172. package/dist/prod/data/image-QD7FUQED.js +0 -1
  173. package/dist/types/element/src/Shape.d.ts +0 -17
  174. package/dist/types/element/src/ShapeCache.d.ts +0 -25
  175. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  176. package/dist/types/excalidraw/store.d.ts +0 -129
  177. package/dist/types/utils/src/collision.d.ts +0 -8
  178. /package/dist/dev/data/{image-XPEIZ6XQ.js.map → image-BBHDGXQ3.js.map} +0 -0
  179. /package/dist/dev/locales/{en-R455UJTM.js.map → en-2WXBKZE2.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
2
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
3
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { Scene } from "./Scene";
4
4
  export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
5
5
  x: number;
6
6
  y: number;
@@ -9,7 +9,7 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
9
9
  y: number;
10
10
  }, gridSize: NullableGridSize) => void;
11
11
  export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
12
- export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, widthAspectRatio, originOffset, informMutation, }: {
12
+ export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
13
13
  newElement: NonDeletedExcalidrawElement;
14
14
  elementType: AppState["activeTool"]["type"];
15
15
  originX: number;
@@ -21,6 +21,7 @@ export declare const dragNewElement: ({ newElement, elementType, originX, origin
21
21
  shouldMaintainAspectRatio: boolean;
22
22
  shouldResizeFromCenter: boolean;
23
23
  zoom: NormalizedZoomValue;
24
+ scene: Scene;
24
25
  /** whether to keep given aspect ratio when `isResizeWithSidesSameLength` is
25
26
  true */
26
27
  widthAspectRatio?: number | null | undefined;
@@ -8,10 +8,10 @@ export declare const BASE_PADDING = 40;
8
8
  */
9
9
  export declare const updateElbowArrowPoints: (arrow: Readonly<ExcalidrawElbowArrowElement>, elementsMap: NonDeletedSceneElementsMap, updates: {
10
10
  points?: readonly LocalPoint[];
11
- fixedSegments?: FixedSegment[] | null;
11
+ fixedSegments?: readonly FixedSegment[] | null;
12
12
  startBinding?: FixedPointBinding | null;
13
13
  endBinding?: FixedPointBinding | null;
14
14
  }, options?: {
15
15
  isDragging?: boolean;
16
16
  }) => ElementUpdate<ExcalidrawElbowArrowElement>;
17
- export declare const validateElbowPoints: <P extends GlobalPoint | LocalPoint>(points: readonly P[], tolerance?: number) => boolean;
17
+ export declare const validateElbowPoints: <P extends LocalPoint | GlobalPoint>(points: readonly P[], tolerance?: number) => boolean;
@@ -1,9 +1,10 @@
1
1
  import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
2
2
  import { type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
3
+ import type { Scene } from "./Scene";
3
4
  type LinkDirection = "up" | "right" | "down" | "left";
4
5
  export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
5
6
  export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
6
- export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap, appState: AppState, direction: LinkDirection, numberOfNodes: number) => ExcalidrawElement[];
7
+ export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => ExcalidrawElement[];
7
8
  export declare class FlowChartNavigator {
8
9
  isExploring: boolean;
9
10
  private sameLevelNodes;
@@ -18,7 +19,7 @@ export declare class FlowChartCreator {
18
19
  private numberOfNodes;
19
20
  private direction;
20
21
  pendingNodes: PendingExcalidrawElements | null;
21
- createNodes(startNode: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap, appState: AppState, direction: LinkDirection): void;
22
+ createNodes(startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene): void;
22
23
  clear(): void;
23
24
  }
24
25
  export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, OrderedExcalidrawElement } from "./types";
1
+ import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement, SceneElementsMap } from "./types";
2
2
  export declare class InvalidFractionalIndexError extends Error {
3
3
  code: "ELEMENT_HAS_INVALID_INDEX";
4
4
  }
@@ -42,10 +42,16 @@ export declare const orderByFractionalIndex: (elements: OrderedExcalidrawElement
42
42
  * Synchronizes invalid fractional indices of moved elements with the array order by mutating passed elements.
43
43
  * If the synchronization fails or the result is invalid, it fallbacks to `syncInvalidIndices`.
44
44
  */
45
- export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: Map<string, ExcalidrawElement>) => OrderedExcalidrawElement[];
45
+ export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: ElementsMap) => OrderedExcalidrawElement[];
46
46
  /**
47
- * Synchronizes all invalid fractional indices with the array order by mutating passed elements.
47
+ * Synchronizes all invalid fractional indices within the array order by mutating elements in the passed array.
48
48
  *
49
49
  * WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
50
50
  */
51
51
  export declare const syncInvalidIndices: (elements: readonly ExcalidrawElement[]) => OrderedExcalidrawElement[];
52
+ /**
53
+ * Synchronizes all invalid fractional indices within the array order by creating new instances of elements with corrected indices.
54
+ *
55
+ * WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
56
+ */
57
+ export declare const syncInvalidIndicesImmutable: (elements: readonly ExcalidrawElement[]) => SceneElementsMap | undefined;
@@ -1,6 +1,6 @@
1
- import type { ExcalidrawElementsIncludingDeleted } from "@excalidraw/excalidraw/scene/Scene";
2
1
  import type { AppClassProperties, AppState, StaticCanvasAppState } from "@excalidraw/excalidraw/types";
3
2
  import type { ReadonlySetLike } from "@excalidraw/common/utility-types";
3
+ import type { ExcalidrawElementsIncludingDeleted } from "./Scene";
4
4
  import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
5
5
  export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], origElements: readonly ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
6
6
  export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
@@ -31,8 +31,8 @@ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsInclu
31
31
  */
32
32
  export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
33
33
  export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState, elementsMap: ElementsMap) => ExcalidrawElement[];
34
- export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement)[];
35
- export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement)[];
34
+ export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement)[];
35
+ export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement)[];
36
36
  export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap: ElementsMap) => ExcalidrawFrameLikeElement | null;
37
37
  /** */
38
38
  export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
@@ -64,6 +64,7 @@ export declare const isElementInFrame: (element: ExcalidrawElement, allElementsM
64
64
  checkedGroups?: Map<string, boolean>;
65
65
  }) => boolean;
66
66
  export declare const shouldApplyFrameClip: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, appState: StaticCanvasAppState, elementsMap: ElementsMap, checkedGroups?: Map<string, boolean>) => boolean;
67
+ export declare const getDefaultFrameName: (element: ExcalidrawFrameLikeElement) => "Frame" | "AI Frame";
67
68
  export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement) => string;
68
69
  export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => NonDeletedExcalidrawElement[];
69
70
  export declare const frameAndChildrenSelectedTogether: (selectedElements: readonly ExcalidrawElement[]) => boolean;
@@ -6,8 +6,8 @@ export declare const HEADING_LEFT: Heading;
6
6
  export declare const HEADING_UP: Heading;
7
7
  export type Heading = [1, 0] | [0, 1] | [-1, 0] | [0, -1];
8
8
  export declare const vectorToHeading: (vec: Vector) => Heading;
9
- export declare const headingForPoint: <P extends GlobalPoint | LocalPoint>(p: P, o: P) => Heading;
10
- export declare const headingForPointIsHorizontal: <P extends GlobalPoint | LocalPoint>(p: P, o: P) => boolean;
9
+ export declare const headingForPoint: <P extends LocalPoint | GlobalPoint>(p: P, o: P) => Heading;
10
+ export declare const headingForPointIsHorizontal: <P extends LocalPoint | GlobalPoint>(p: P, o: P) => boolean;
11
11
  export declare const compareHeading: (a: Heading, b: Heading) => boolean;
12
12
  export declare const headingIsHorizontal: (a: Heading) => boolean;
13
13
  export declare const headingIsVertical: (a: Heading) => boolean;
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
1
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ElementsMapOrArray } from "./types";
2
2
  /**
3
3
  * @deprecated unsafe, use hashElementsVersion instead
4
4
  */
@@ -6,7 +6,7 @@ export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) =
6
6
  /**
7
7
  * Hashes elements' versionNonce (using djb2 algo). Order of elements matters.
8
8
  */
9
- export declare const hashElementsVersion: (elements: readonly ExcalidrawElement[]) => number;
9
+ export declare const hashElementsVersion: (elements: ElementsMapOrArray) => number;
10
10
  export declare const hashString: (s: string) => number;
11
11
  export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
12
12
  export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
@@ -14,3 +14,44 @@ 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 "./renderElement";
42
+ export * from "./resizeElements";
43
+ export * from "./resizeTest";
44
+ export * from "./Scene";
45
+ export * from "./selection";
46
+ export * from "./shape";
47
+ export * from "./showSelectedShapeActions";
48
+ export * from "./sizeHelpers";
49
+ export * from "./sortElements";
50
+ export * from "./store";
51
+ export * from "./textElement";
52
+ export * from "./textMeasurements";
53
+ export * from "./textWrapping";
54
+ export * from "./transformHandles";
55
+ export * from "./typeChecks";
56
+ export * from "./utils";
57
+ export * from "./zindex";
@@ -1,15 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
3
- import Scene from "@excalidraw/excalidraw/scene/Scene";
4
- import type { Store } from "@excalidraw/excalidraw/store";
3
+ import { type Store } from "@excalidraw/element";
5
4
  import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize, Zoom } from "@excalidraw/excalidraw/types";
5
+ import type { Scene } from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
- import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, SceneElementsMap, ExcalidrawElbowArrowElement } from "./types";
8
- declare const editorMidPointsCache: {
9
- version: number | null;
10
- points: (GlobalPoint | null)[];
11
- zoom: number | null;
12
- };
7
+ import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, PointsPositionUpdates } from "./types";
13
8
  export declare class LinearElementEditor {
14
9
  readonly elementId: ExcalidrawElement["id"] & {
15
10
  _brand: "excalidrawLinearElementId";
@@ -43,7 +38,8 @@ 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>);
41
+ readonly customLineAngle: number | null;
42
+ constructor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap);
47
43
  static POINT_HANDLE_SIZE: number;
48
44
  /**
49
45
  * @param id the `elementId` from the instance of this class (so that we can
@@ -59,14 +55,13 @@ export declare class LinearElementEditor {
59
55
  y: number;
60
56
  }[]) => void, linearElementEditor: LinearElementEditor, scene: Scene): LinearElementEditor | null;
61
57
  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;
58
+ static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (GlobalPoint | null)[];
64
59
  static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
65
60
  x: number;
66
61
  y: number;
67
62
  }, appState: AppState, elementsMap: ElementsMap) => GlobalPoint | null;
68
63
  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;
64
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, index: number): GlobalPoint;
70
65
  static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: GlobalPoint, elementsMap: ElementsMap): number;
71
66
  static handlePointerDown(event: React.PointerEvent<HTMLElement>, app: AppClassProperties, store: Store, scenePointer: {
72
67
  x: number;
@@ -77,7 +72,7 @@ export declare class LinearElementEditor {
77
72
  linearElementEditor: LinearElementEditor | null;
78
73
  };
79
74
  static arePointsEqual<Point extends LocalPoint | GlobalPoint>(point1: Point | null, point2: Point | null): boolean;
80
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): LinearElementEditor | null;
75
+ static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties): LinearElementEditor | null;
81
76
  /** scene coords */
82
77
  static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, p: LocalPoint, elementsMap: ElementsMap): GlobalPoint;
83
78
  /** scene coords */
@@ -89,30 +84,25 @@ export declare class LinearElementEditor {
89
84
  static createPointAt(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, scenePointerX: number, scenePointerY: number, gridSize: NullableGridSize): LocalPoint;
90
85
  /**
91
86
  * 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.
87
+ * expected in various parts of the codebase.
88
+ *
89
+ * Also returns normalized x and y coords to account for the normalization
90
+ * of the points.
94
91
  */
95
- static getNormalizedPoints(element: ExcalidrawLinearElement): {
92
+ static getNormalizeElementPointsAndCoords(element: ExcalidrawLinearElement): {
96
93
  points: LocalPoint[];
97
94
  x: number;
98
95
  y: number;
99
96
  };
100
- static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
101
- static duplicateSelectedPoints(appState: AppState, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): AppState;
102
- static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
103
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
104
- point: LocalPoint;
105
- }[]): void;
106
- static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
107
- index: number;
108
- point: LocalPoint;
109
- isDragging?: boolean;
110
- }[], otherUpdates?: {
97
+ static duplicateSelectedPoints(appState: AppState, scene: Scene): AppState;
98
+ static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, app: AppClassProperties, pointIndices: readonly number[]): void;
99
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, addedPoints: LocalPoint[]): void;
100
+ static movePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, pointUpdates: PointsPositionUpdates, otherUpdates?: {
111
101
  startBinding?: PointBinding | null;
112
102
  endBinding?: PointBinding | null;
113
- }, sceneElementsMap?: NonDeletedSceneElementsMap): void;
103
+ }): void;
114
104
  static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
115
- static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, elementsMap: ElementsMap): {
105
+ static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, scene: Scene): {
116
106
  pointerDownState: LinearElementEditor["pointerDownState"];
117
107
  selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
118
108
  } | undefined;
@@ -124,7 +114,6 @@ export declare class LinearElementEditor {
124
114
  };
125
115
  static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
126
116
  static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
127
- static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, elementsMap: ElementsMap): LinearElementEditor;
128
- static deleteFixedSegment(element: ExcalidrawElbowArrowElement, index: number): void;
117
+ static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, scene: Scene): LinearElementEditor;
118
+ static deleteFixedSegment(element: ExcalidrawElbowArrowElement, scene: Scene, index: number): void;
129
119
  }
130
- export {};
@@ -1,7 +1,15 @@
1
1
  import type { Mutable } from "@excalidraw/common/utility-types";
2
- import type { ExcalidrawElement } from "./types";
3
- export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
4
- export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean, options?: {
2
+ import type { ElementsMap, ExcalidrawElement } from "./types";
3
+ export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "updated">;
4
+ /**
5
+ * This function tracks updates of text elements for the purposes for collaboration.
6
+ * The version is used to compare updates when more than one user is working in
7
+ * the same drawing.
8
+ *
9
+ * WARNING: this won't trigger the component to update, so if you need to trigger component update,
10
+ * use `scene.mutateElement` or `ExcalidrawImperativeAPI.mutateElement` instead.
11
+ */
12
+ export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, elementsMap: ElementsMap, updates: ElementUpdate<TElement>, options?: {
5
13
  isDragging?: boolean;
6
14
  }) => TElement;
7
15
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>, force?: boolean) => TElement;
@@ -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, FixedSegment, 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"];
@@ -50,8 +51,8 @@ export declare const newArrowElement: <T extends boolean>(opts: {
50
51
  endArrowhead?: Arrowhead | null | undefined;
51
52
  points?: readonly import("@excalidraw/math").LocalPoint[] | undefined;
52
53
  elbowed?: T | undefined;
53
- fixedSegments?: 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>;
54
+ fixedSegments?: readonly import("./types").FixedSegment[] | null | undefined;
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"];
@@ -1,10 +1,10 @@
1
1
  import { type LocalPoint } from "@excalidraw/math";
2
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
3
2
  import type { PointerDownState } from "@excalidraw/excalidraw/types";
3
+ import type { Scene } from "./Scene";
4
4
  import type { BoundingBox } from "./bounds";
5
5
  import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
6
- import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap, SceneElementsMap } from "./types";
7
- export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: SceneElementsMap, scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
6
+ import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap } from "./types";
7
+ export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
8
8
  export declare const rescalePointsInElement: (element: NonDeletedExcalidrawElement, width: number, height: number, normalizePoints: boolean) => {
9
9
  points: LocalPoint[];
10
10
  } | {
@@ -13,9 +13,10 @@ 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
- export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, elementsMap: ElementsMap, originalElementsMap: ElementsMap, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
19
+ export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, originalElementsMap: ElementsMap, scene: Scene, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
19
20
  shouldMaintainAspectRatio?: boolean | undefined;
20
21
  shouldResizeFromCenter?: boolean | undefined;
21
22
  shouldInformMutation?: boolean | undefined;
@@ -3,12 +3,12 @@ import type { AppState, Device, Zoom } from "@excalidraw/excalidraw/types";
3
3
  import type { Bounds } from "./bounds";
4
4
  import type { MaybeTransformHandleType } from "./transformHandles";
5
5
  import type { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
6
- export declare const resizeTest: <Point extends GlobalPoint | LocalPoint>(element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
6
+ export declare const resizeTest: <Point extends LocalPoint | GlobalPoint>(element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
7
7
  export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap, device: Device) => {
8
8
  element: NonDeletedExcalidrawElement;
9
9
  transformHandleType: MaybeTransformHandleType;
10
10
  } | null;
11
- export declare const getTransformHandleTypeFromCoords: <Point extends GlobalPoint | LocalPoint>([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
11
+ export declare const getTransformHandleTypeFromCoords: <Point extends LocalPoint | GlobalPoint>([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, device: Device) => MaybeTransformHandleType;
12
12
  export declare const getCursorForResizingElement: (resizingElement: {
13
13
  element?: ExcalidrawElement;
14
14
  transformHandleType: MaybeTransformHandleType;
@@ -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;
@@ -32,12 +27,12 @@ export declare const makeNextSelectedElementIds: (nextSelectedElementIds: AppSta
32
27
  [id: string]: true;
33
28
  }>;
34
29
  export declare const getSelectionStateForElements: (targetElements: readonly ExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => {
35
- editingGroupId: string | null;
36
30
  selectedElementIds: Readonly<{
37
31
  [id: string]: true;
38
32
  }>;
39
33
  selectedGroupIds: {
40
34
  [groupId: string]: boolean;
41
35
  };
36
+ editingGroupId: string | null;
42
37
  selectedLinearElement: LinearElementEditor | null;
43
38
  };
@@ -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 import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | ExcalidrawLinearElement | import("./types").ExcalidrawArrowElement | ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement>(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 LocalPoint | GlobalPoint>(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;
@@ -2,7 +2,7 @@ import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
2
  import { type GeometricShape } from "@excalidraw/utils/shape";
3
3
  import type { Zoom } from "@excalidraw/excalidraw/types";
4
4
  import { type Bounds } from "./bounds";
5
- import type { ExcalidrawElement, ElementsMap, NonDeleted, ExcalidrawLinearElement } from "./types";
5
+ import type { ExcalidrawElement, ElementsMap, NonDeleted, ExcalidrawLinearElement, NonDeletedSceneElementsMap } from "./types";
6
6
  export type ToolCategory = "manipulation" | "elements";
7
7
  export declare const SHAPES: readonly [{
8
8
  readonly icon: import("react/jsx-runtime").JSX.Element;
@@ -75,22 +75,22 @@ export declare const SHAPES: readonly [{
75
75
  readonly fillable: false;
76
76
  readonly myocSimplifiedMode: true;
77
77
  }];
78
- export declare const findShapeByKey: (key: string) => "line" | "ellipse" | "text" | "rectangle" | "diamond" | "image" | "selection" | "arrow" | "freedraw" | "eraser" | null;
78
+ export declare const findShapeByKey: (key: string) => "text" | "line" | "arrow" | "selection" | "rectangle" | "diamond" | "ellipse" | "freedraw" | "image" | "eraser" | null;
79
79
  /**
80
80
  * get the pure geometric shape of an excalidraw elementw
81
81
  * which is then used for hit detection
82
82
  */
83
- export declare const getElementShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point>;
84
- export declare const getBoundTextShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point> | null;
85
- export declare const getControlPointsForBezierCurve: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => P[] | null;
86
- export declare const getBezierXY: <P extends GlobalPoint | LocalPoint>(p0: P, p1: P, p2: P, p3: P, t: number) => P;
87
- export declare const getBezierCurveLength: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => number;
88
- export declare const mapIntervalToBezierT: <P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P, interval: number) => number;
83
+ export declare const getElementShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point>;
84
+ export declare const getBoundTextShape: <Point extends LocalPoint | GlobalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap) => GeometricShape<Point> | null;
85
+ export declare const getControlPointsForBezierCurve: <P extends LocalPoint | GlobalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => P[] | null;
86
+ export declare const getBezierXY: <P extends LocalPoint | GlobalPoint>(p0: P, p1: P, p2: P, p3: P, t: number) => P;
87
+ export declare const getBezierCurveLength: <P extends LocalPoint | GlobalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P) => number;
88
+ export declare const mapIntervalToBezierT: <P extends LocalPoint | GlobalPoint>(element: NonDeleted<ExcalidrawLinearElement>, endPoint: P, interval: number) => number;
89
89
  /**
90
90
  * Get the axis-aligned bounding box for a given element
91
91
  */
92
- export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, offset?: [number, number, number, number]) => Bounds;
93
- export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
92
+ export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: NonDeletedSceneElementsMap, offset?: [number, number, number, number]) => Bounds;
93
+ export declare const pointInsideBounds: <P extends LocalPoint | GlobalPoint>(p: P, bounds: Bounds) => boolean;
94
94
  export declare const aabbsOverlapping: (a: Bounds, b: Bounds) => boolean;
95
95
  export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
96
96
  export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
@@ -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,11 +23,10 @@ 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
  };
29
- export declare const resizePerfectLineForNWHandler: (element: ExcalidrawElement, x: number, y: number) => void;
30
30
  export declare const getNormalizedDimensions: (element: Pick<ExcalidrawElement, "width" | "height" | "x" | "y">) => {
31
31
  width: ExcalidrawElement["width"];
32
32
  height: ExcalidrawElement["height"];