@excalidraw/excalidraw 0.18.0-58f7d33 → 0.18.0-5fffc47

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 (198) hide show
  1. package/dist/dev/chunk-CP5DND7P.js +7 -0
  2. package/dist/dev/chunk-CP5DND7P.js.map +7 -0
  3. package/dist/dev/{chunk-X3RYHLJU.js → chunk-PWQMCSHA.js} +26 -8
  4. package/dist/dev/chunk-PWQMCSHA.js.map +7 -0
  5. package/dist/dev/chunk-YMRX7R7U.js +5671 -0
  6. package/dist/dev/chunk-YMRX7R7U.js.map +7 -0
  7. package/dist/dev/data/{image-U2IPNUKJ.js → image-L23D26XS.js} +3 -3
  8. package/dist/dev/index.css +964 -501
  9. package/dist/dev/index.css.map +3 -3
  10. package/dist/dev/index.js +11915 -10771
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-CKWC2GMK.js → en-V3NQTBPG.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-GF46JCB3.js +12 -0
  17. package/dist/prod/chunk-HT4FKTIQ.js +4 -0
  18. package/dist/prod/data/image-NWF7UX55.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +25 -17
  21. package/dist/prod/locales/{en-SBO6ZHT2.js → en-LQE6K457.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 +44 -7
  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/utility-types.d.ts +5 -0
  29. package/dist/types/common/src/utils.d.ts +20 -4
  30. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
  31. package/dist/types/element/src/align.d.ts +4 -3
  32. package/dist/types/element/src/binding.d.ts +26 -16
  33. package/dist/types/element/src/bounds.d.ts +14 -6
  34. package/dist/types/element/src/collision.d.ts +18 -12
  35. package/dist/types/element/src/cropElement.d.ts +1 -1
  36. package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
  37. package/dist/types/element/src/distance.d.ts +2 -2
  38. package/dist/types/element/src/distribute.d.ts +2 -1
  39. package/dist/types/element/src/dragElements.d.ts +3 -2
  40. package/dist/types/element/src/duplicate.d.ts +10 -13
  41. package/dist/types/element/src/elbowArrow.d.ts +1 -1
  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 +5 -4
  45. package/dist/types/element/src/groups.d.ts +1 -0
  46. package/dist/types/element/src/index.d.ts +44 -2
  47. package/dist/types/element/src/linearElementEditor.d.ts +23 -36
  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/positionElementsOnGrid.d.ts +2 -0
  51. package/dist/types/element/src/renderElement.d.ts +4 -1
  52. package/dist/types/element/src/resizeElements.d.ts +5 -4
  53. package/dist/types/element/src/selection.d.ts +11 -5
  54. package/dist/types/element/src/shape.d.ts +42 -0
  55. package/dist/types/element/src/sizeHelpers.d.ts +2 -2
  56. package/dist/types/element/src/store.d.ts +237 -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 +16 -6
  61. package/dist/types/element/src/zindex.d.ts +1 -1
  62. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +57 -54
  63. package/dist/types/excalidraw/actions/actionBoundText.d.ts +38 -36
  64. package/dist/types/excalidraw/actions/actionCanvas.d.ts +256 -242
  65. package/dist/types/excalidraw/actions/actionClipboard.d.ts +114 -106
  66. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +19 -18
  67. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +57 -53
  68. package/dist/types/excalidraw/actions/actionElementLink.d.ts +18 -17
  69. package/dist/types/excalidraw/actions/actionElementLock.d.ts +53 -52
  70. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +19 -18
  71. package/dist/types/excalidraw/actions/actionExport.d.ts +181 -172
  72. package/dist/types/excalidraw/actions/actionFinalize.d.ts +85 -42
  73. package/dist/types/excalidraw/actions/actionFrame.d.ts +123 -119
  74. package/dist/types/excalidraw/actions/actionGroup.d.ts +38 -36
  75. package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
  76. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +545 -20
  77. package/dist/types/excalidraw/actions/actionLink.d.ts +18 -17
  78. package/dist/types/excalidraw/actions/actionMenu.d.ts +18 -391
  79. package/dist/types/excalidraw/actions/actionNavigate.d.ts +38 -36
  80. package/dist/types/excalidraw/actions/actionProperties.d.ts +305 -273
  81. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +19 -18
  82. package/dist/types/excalidraw/actions/actionStyles.d.ts +19 -18
  83. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +19 -18
  84. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +19 -18
  85. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +18 -190
  86. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  87. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +19 -18
  88. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +19 -18
  89. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +19 -18
  90. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  91. package/dist/types/excalidraw/actions/types.d.ts +4 -3
  92. package/dist/types/excalidraw/appState.d.ts +23 -10
  93. package/dist/types/excalidraw/clipboard.d.ts +64 -1
  94. package/dist/types/excalidraw/components/Actions.d.ts +17 -7
  95. package/dist/types/excalidraw/components/App.d.ts +35 -22
  96. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  97. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  98. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +6 -1
  99. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  100. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
  101. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
  102. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
  103. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  104. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  105. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  106. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  107. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  108. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  109. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  110. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  111. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  112. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  113. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  114. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  115. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  116. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  117. package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
  118. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  119. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  120. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  121. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  122. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  123. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  124. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  125. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  126. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  127. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  128. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  129. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  130. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  131. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  132. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  133. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  134. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  135. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  136. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  137. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  138. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  139. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  140. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  141. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  142. package/dist/types/excalidraw/components/icons.d.ts +8 -0
  143. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  144. package/dist/types/excalidraw/data/blob.d.ts +3 -7
  145. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  146. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  147. package/dist/types/excalidraw/data/transform.d.ts +1 -1
  148. package/dist/types/excalidraw/data/types.d.ts +4 -1
  149. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  150. package/dist/types/excalidraw/eraser/index.d.ts +0 -2
  151. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  152. package/dist/types/excalidraw/history.d.ts +30 -22
  153. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  154. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  155. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  156. package/dist/types/excalidraw/index.d.ts +11 -10
  157. package/dist/types/excalidraw/lasso/index.d.ts +1 -0
  158. package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
  159. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
  160. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  161. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
  162. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  163. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  164. package/dist/types/excalidraw/scene/types.d.ts +2 -0
  165. package/dist/types/excalidraw/snapping.d.ts +2 -2
  166. package/dist/types/excalidraw/types.d.ts +46 -16
  167. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  168. package/dist/types/math/src/angle.d.ts +2 -0
  169. package/dist/types/math/src/constants.d.ts +3 -0
  170. package/dist/types/math/src/curve.d.ts +34 -0
  171. package/dist/types/math/src/index.d.ts +1 -0
  172. package/dist/types/math/src/point.d.ts +1 -1
  173. package/dist/types/math/src/rectangle.d.ts +2 -0
  174. package/dist/types/math/src/segment.d.ts +1 -0
  175. package/dist/types/math/src/vector.d.ts +8 -2
  176. package/dist/types/utils/src/bbox.d.ts +1 -1
  177. package/dist/types/utils/src/index.d.ts +1 -1
  178. package/dist/types/utils/src/withinBounds.d.ts +1 -1
  179. package/history.ts +146 -109
  180. package/package.json +13 -10
  181. package/dist/dev/chunk-KKJLIRJU.js +0 -7
  182. package/dist/dev/chunk-KKJLIRJU.js.map +0 -7
  183. package/dist/dev/chunk-LEJJ2YZY.js +0 -18711
  184. package/dist/dev/chunk-LEJJ2YZY.js.map +0 -7
  185. package/dist/dev/chunk-X3RYHLJU.js.map +0 -7
  186. package/dist/prod/chunk-IUH5AXLB.js +0 -12
  187. package/dist/prod/chunk-QUX7WTVH.js +0 -7
  188. package/dist/prod/chunk-RQK6WG4F.js +0 -33
  189. package/dist/prod/data/image-UQDATCXC.js +0 -1
  190. package/dist/types/element/src/Shape.d.ts +0 -17
  191. package/dist/types/element/src/ShapeCache.d.ts +0 -25
  192. package/dist/types/element/src/shapes.d.ts +0 -23
  193. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  194. package/dist/types/excalidraw/store.d.ts +0 -129
  195. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  196. package/dist/types/utils/src/collision.d.ts +0 -8
  197. /package/dist/dev/data/{image-U2IPNUKJ.js.map → image-L23D26XS.js.map} +0 -0
  198. /package/dist/dev/locales/{en-CKWC2GMK.js.map → en-V3NQTBPG.js.map} +0 -0
@@ -1,8 +1,9 @@
1
1
  import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
2
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
3
3
  export declare const getLassoSelectedElementIds: (input: {
4
4
  lassoPath: GlobalPoint[];
5
5
  elements: readonly ExcalidrawElement[];
6
+ elementsMap: ElementsMap;
6
7
  elementsSegments: ElementsSegmentsMap;
7
8
  intersectedElements: Set<ExcalidrawElement["id"]>;
8
9
  enclosedElements: Set<ExcalidrawElement["id"]>;
@@ -1,6 +1,7 @@
1
+ import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
1
2
  import type { StaticCanvasRenderConfig } from "../scene/types";
2
- import type { StaticCanvasAppState, AppState } from "../types";
3
- export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
3
+ import type { AppState, StaticCanvasAppState } from "../types";
4
+ export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
4
5
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
6
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
6
7
  canvas: HTMLCanvasElement;
@@ -11,3 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
11
12
  isExporting?: boolean | undefined;
12
13
  viewBackgroundColor?: string | null | undefined;
13
14
  }) => CanvasRenderingContext2D;
15
+ export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, elementsMap: ElementsMap, padding: number) => void;
16
+ export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
17
+ export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
18
+ export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement, elementsMap: ElementsMap) => void;
@@ -1,4 +1,7 @@
1
- import type { StaticSceneRenderConfig } from "../scene/types";
1
+ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
2
+ import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
3
+ import type { StaticCanvasAppState } from "../types";
4
+ export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
2
5
  /** throttled to animation framerate */
3
6
  export declare const renderStaticSceneThrottled: {
4
7
  (config: StaticSceneRenderConfig): void;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "./Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../types";
4
4
  export declare class Renderer {
5
5
  private scene;
@@ -16,7 +16,6 @@ export declare class Renderer {
16
16
  /** note: first render of newElement will always bust the cache
17
17
  * (we'd have to prefilter elements outside of this function) */
18
18
  newElementId: ExcalidrawElement["id"] | undefined;
19
- pendingImageElementId: AppState["pendingImageElementId"];
20
19
  sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
21
20
  }) => {
22
21
  elementsMap: Map<string, NonDeletedExcalidrawElement> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedElementsMap"> & import("@excalidraw/common/utility-types").MakeBrand<"RenderableElementsMap">;
@@ -1,4 +1,4 @@
1
- export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "@excalidraw/element/selection";
1
+ export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
2
2
  export { calculateScrollCenter } from "./scroll";
3
- export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element/comparisons";
3
+ export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
4
4
  export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
@@ -1,10 +1,9 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
1
  import type { InteractiveCanvasAppState } from "../types";
3
- import type { ScrollBars } from "./types";
2
+ import type { RenderableElementsMap, ScrollBars } from "./types";
4
3
  export declare const SCROLLBAR_MARGIN = 4;
5
4
  export declare const SCROLLBAR_WIDTH = 6;
6
5
  export declare const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
7
- export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
6
+ export declare const getScrollBars: (elements: RenderableElementsMap, viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
8
7
  export declare const isOverScrollBars: (scrollBars: ScrollBars, x: number, y: number) => {
9
8
  isOverEither: boolean;
10
9
  isOverHorizontal: boolean;
@@ -93,12 +93,14 @@ export type ScrollBars = {
93
93
  y: number;
94
94
  width: number;
95
95
  height: number;
96
+ deltaMultiplier: number;
96
97
  } | null;
97
98
  vertical: {
98
99
  x: number;
99
100
  y: number;
100
101
  width: number;
101
102
  height: number;
103
+ deltaMultiplier: number;
102
104
  } | null;
103
105
  };
104
106
  export type ElementShape = Drawable | Drawable[] | null;
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { InclusiveRange } from "@excalidraw/math";
3
- import type { Bounds } from "@excalidraw/element/bounds";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
3
+ import type { Bounds } from "@excalidraw/element";
4
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
5
5
  import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
6
6
  import type { AppClassProperties, AppState, KeyboardModifiersObject } from "./types";
7
7
  export declare const getSnapDistance: (zoomValue: number) => number;
@@ -1,9 +1,10 @@
1
1
  import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@excalidraw/common";
2
- import type { SuggestedBinding } from "@excalidraw/element/binding";
3
- import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
5
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
2
+ import type { SuggestedBinding } from "@excalidraw/element";
3
+ import type { LinearElementEditor } from "@excalidraw/element";
4
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
5
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
6
6
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
8
  import type { Action } from "./actions/types";
8
9
  import type { Spreadsheet } from "./charts";
9
10
  import type { ClipboardData } from "./clipboard";
@@ -12,7 +13,6 @@ import type Library from "./data/library";
12
13
  import type { FileSystemHandle } from "./data/filesystem";
13
14
  import type { ContextMenuItems } from "./components/ContextMenu";
14
15
  import type { SnapLine } from "./snapping";
15
- import type { CaptureUpdateActionType } from "./store";
16
16
  import type { ImportedDataState } from "./data/types";
17
17
  import type { Language } from "./i18n";
18
18
  import type { isOverScrollBars } from "./scene/scrollbars";
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
113
113
  offsetLeft: AppState["offsetLeft"];
114
114
  offsetTop: AppState["offsetTop"];
115
115
  theme: AppState["theme"];
116
- pendingImageElementId: AppState["pendingImageElementId"];
117
116
  };
118
117
  export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
119
118
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
@@ -130,7 +129,6 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
130
129
  }>;
131
130
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
132
131
  activeEmbeddable: AppState["activeEmbeddable"];
133
- editingLinearElement: AppState["editingLinearElement"];
134
132
  selectionElement: AppState["selectionElement"];
135
133
  selectedGroupIds: AppState["selectedGroupIds"];
136
134
  selectedLinearElement: AppState["selectedLinearElement"];
@@ -146,6 +144,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
146
144
  isCropping: AppState["isCropping"];
147
145
  croppingElementId: AppState["croppingElementId"];
148
146
  searchMatches: AppState["searchMatches"];
147
+ activeLockedId: AppState["activeLockedId"];
149
148
  }>;
150
149
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
151
150
  export type ObservedStandaloneAppState = {
@@ -156,9 +155,13 @@ export type ObservedElementsAppState = {
156
155
  editingGroupId: AppState["editingGroupId"];
157
156
  selectedElementIds: AppState["selectedElementIds"];
158
157
  selectedGroupIds: AppState["selectedGroupIds"];
159
- editingLinearElementId: LinearElementEditor["elementId"] | null;
160
- selectedLinearElementId: LinearElementEditor["elementId"] | null;
158
+ selectedLinearElement: {
159
+ elementId: LinearElementEditor["elementId"];
160
+ isEditing: boolean;
161
+ } | null;
161
162
  croppingElementId: AppState["croppingElementId"];
163
+ lockedMultiSelections: AppState["lockedMultiSelections"];
164
+ activeLockedId: AppState["activeLockedId"];
162
165
  };
163
166
  export interface AppState {
164
167
  contextMenu: {
@@ -209,7 +212,6 @@ export interface AppState {
209
212
  * set when a new text is created or when an existing text is being edited
210
213
  */
211
214
  editingTextElement: NonDeletedExcalidrawElement | null;
212
- editingLinearElement: LinearElementEditor | null;
213
215
  activeTool: {
214
216
  /**
215
217
  * indicates a previous tool we should revert back to if we deselect the
@@ -219,6 +221,10 @@ export interface AppState {
219
221
  locked: boolean;
220
222
  fromSelection: boolean;
221
223
  } & ActiveTool;
224
+ preferredSelectionTool: {
225
+ type: "selection" | "lasso";
226
+ initialized: boolean;
227
+ };
222
228
  penMode: boolean;
223
229
  penDetected: boolean;
224
230
  exportBackground: boolean;
@@ -249,8 +255,8 @@ export interface AppState {
249
255
  isResizing: boolean;
250
256
  isRotating: boolean;
251
257
  zoom: Zoom;
252
- openMenu: "canvas" | "shape" | null;
253
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
258
+ openMenu: "canvas" | null;
259
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
254
260
  openSidebar: {
255
261
  name: SidebarName;
256
262
  tab?: SidebarTabName;
@@ -324,8 +330,6 @@ export interface AppState {
324
330
  shown: true;
325
331
  data: Spreadsheet;
326
332
  };
327
- /** imageElement waiting to be placed on canvas */
328
- pendingImageElementId: ExcalidrawImageElement["id"] | null;
329
333
  showHyperlinkPopup: false | "info" | "editor";
330
334
  selectedLinearElement: LinearElementEditor | null;
331
335
  snapLines: readonly SnapLine[];
@@ -341,9 +345,20 @@ export interface AppState {
341
345
  /** image cropping */
342
346
  isCropping: boolean;
343
347
  croppingElementId: ExcalidrawElement["id"] | null;
344
- searchMatches: readonly SearchMatch[];
348
+ /** null if no search matches found / search closed */
349
+ searchMatches: Readonly<{
350
+ focusedId: ExcalidrawElement["id"] | null;
351
+ matches: readonly SearchMatch[];
352
+ }> | null;
353
+ /** the locked element/group that's active and shows unlock popup */
354
+ activeLockedId: string | null;
355
+ lockedMultiSelections: {
356
+ [groupId: string]: true;
357
+ };
358
+ /** properties sidebar mode - determines whether to show compact or complete sidebar */
359
+ stylesPanelMode: "compact" | "full" | "mobile";
345
360
  }
346
- type SearchMatch = {
361
+ export type SearchMatch = {
347
362
  id: string;
348
363
  focus: boolean;
349
364
  matchedLines: {
@@ -351,6 +366,7 @@ type SearchMatch = {
351
366
  offsetY: number;
352
367
  width: number;
353
368
  height: number;
369
+ showOnCanvas: boolean;
354
370
  }[];
355
371
  };
356
372
  export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
@@ -403,6 +419,7 @@ export type OnUserFollowedPayload = {
403
419
  };
404
420
  export interface ExcalidrawProps {
405
421
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
422
+ onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
406
423
  initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
407
424
  excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
408
425
  isCollaborating?: boolean;
@@ -430,6 +447,7 @@ export interface ExcalidrawProps {
430
447
  onDuplicate?: (nextElements: readonly ExcalidrawElement[],
431
448
  /** excludes the duplicated elements */
432
449
  prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
450
+ renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
433
451
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
434
452
  langCode?: Language["code"];
435
453
  viewModeEnabled?: boolean;
@@ -459,6 +477,7 @@ export interface ExcalidrawProps {
459
477
  renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
460
478
  aiEnabled?: boolean;
461
479
  showDeprecatedFonts?: boolean;
480
+ renderScrollbars?: boolean;
462
481
  }
463
482
  export type SceneData = {
464
483
  elements?: ImportedDataState["elements"];
@@ -544,6 +563,8 @@ export type AppClassProperties = {
544
563
  visibleElements: App["visibleElements"];
545
564
  excalidrawContainerValue: App["excalidrawContainerValue"];
546
565
  onPointerUpEmitter: App["onPointerUpEmitter"];
566
+ updateEditorAtom: App["updateEditorAtom"];
567
+ onPointerDownEmitter: App["onPointerDownEmitter"];
547
568
  };
548
569
  export type PointerDownState = Readonly<{
549
570
  origin: Readonly<{
@@ -587,6 +608,11 @@ export type PointerDownState = Readonly<{
587
608
  x: number;
588
609
  y: number;
589
610
  } | null;
611
+ origin: {
612
+ x: number;
613
+ y: number;
614
+ };
615
+ blockDragging: boolean;
590
616
  };
591
617
  eventListeners: {
592
618
  onMove: null | ReturnType<typeof throttleRAF>;
@@ -601,9 +627,12 @@ export type PointerDownState = Readonly<{
601
627
  export type UnsubscribeCallback = () => void;
602
628
  export interface ExcalidrawImperativeAPI {
603
629
  updateScene: InstanceType<typeof App>["updateScene"];
630
+ applyDeltas: InstanceType<typeof App>["applyDeltas"];
631
+ mutateElement: InstanceType<typeof App>["mutateElement"];
604
632
  updateLibrary: InstanceType<typeof Library>["updateLibrary"];
605
633
  resetScene: InstanceType<typeof App>["resetScene"];
606
634
  getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
635
+ getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
607
636
  history: {
608
637
  clear: InstanceType<typeof App>["resetHistory"];
609
638
  };
@@ -628,6 +657,7 @@ export interface ExcalidrawImperativeAPI {
628
657
  */
629
658
  updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
630
659
  onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
660
+ onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
631
661
  onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
632
662
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
633
663
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
@@ -1,5 +1,6 @@
1
1
  import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
2
2
  import type App from "../components/App";
3
+ type SubmitHandler = () => void;
3
4
  export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
4
5
  id: ExcalidrawElement["id"];
5
6
  /**
@@ -19,4 +20,5 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
19
20
  excalidrawContainer: HTMLDivElement | null;
20
21
  app: App;
21
22
  autoSelect?: boolean | undefined;
22
- }) => void;
23
+ }) => SubmitHandler;
24
+ export {};
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
15
15
  * @returns TRUE if the provided angle is a right angle
16
16
  */
17
17
  export declare function isRightAngleRads(rads: Radians): boolean;
18
+ export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
19
+ export declare function radiansDifference(a: Radians, b: Radians): Radians;
@@ -0,0 +1,3 @@
1
+ export declare const PRECISION = 0.0001;
2
+ export declare const LegendreGaussN24TValues: number[];
3
+ export declare const LegendreGaussN24CValues: number[];
@@ -8,6 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
8
8
  * @returns
9
9
  */
10
10
  export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
11
+ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, t: number) => Point;
11
12
  /**
12
13
  * Computes the intersection between a cubic spline and a line segment.
13
14
  */
@@ -38,3 +39,36 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
38
39
  * Determines if the parameter is a Curve
39
40
  */
40
41
  export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
42
+ export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
43
+ export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
44
+ export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
45
+ export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
46
+ export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
47
+ /**
48
+ * Implementation based on Legendre-Gauss quadrature for more accurate arc
49
+ * length calculation.
50
+ *
51
+ * Reference: https://pomax.github.io/bezierinfo/#arclength
52
+ *
53
+ * @param c The curve to calculate the length of
54
+ * @returns The approximated length of the curve
55
+ */
56
+ export declare function curveLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>): number;
57
+ /**
58
+ * Calculates the curve length from t=0 to t=parameter using the same
59
+ * Legendre-Gauss quadrature method used in curveLength
60
+ *
61
+ * @param c The curve to calculate the partial length for
62
+ * @param t The parameter value (0 to 1) to calculate length up to
63
+ * @returns The length of the curve from beginning to parameter t
64
+ */
65
+ export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(c: Curve<P>, t: number): number;
66
+ /**
67
+ * Calculates the point at a specific percentage of a curve's total length
68
+ * using binary search for improved efficiency and accuracy.
69
+ *
70
+ * @param c The curve to calculate point on
71
+ * @param percent A value between 0 and 1 representing the percentage of the curve's length
72
+ * @returns The point at the specified percentage of curve length
73
+ */
74
+ export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number): P;
@@ -1,5 +1,6 @@
1
1
  export * from "./angle";
2
2
  export * from "./curve";
3
+ export * from "./ellipse";
3
4
  export * from "./line";
4
5
  export * from "./point";
5
6
  export * from "./polygon";
@@ -43,7 +43,7 @@ export declare function isPoint(p: unknown): p is LocalPoint | GlobalPoint;
43
43
  * @param b Point The second point to compare
44
44
  * @returns TRUE if the points are sufficiently close to each other
45
45
  */
46
- export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point): boolean;
46
+ export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, tolerance?: number): boolean;
47
47
  /**
48
48
  * Rotate a point by [angle] radians.
49
49
  *
@@ -1,3 +1,5 @@
1
1
  import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
2
2
  export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
3
+ export declare function rectangleFromNumberSequence<Point extends LocalPoint | GlobalPoint>(minX: number, minY: number, maxX: number, maxY: number): Rectangle<Point>;
3
4
  export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
5
+ export declare function rectangleIntersectRectangle<Point extends LocalPoint | GlobalPoint>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean;
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
37
37
  * @returns
38
38
  */
39
39
  export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
40
+ export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
12
12
  *
13
13
  * @param p The point to turn into a vector
14
14
  * @param origin The origin point in a given coordiante system
15
- * @returns The created vector from the point and the origin
15
+ * @param threshold The threshold to consider the vector as 'undefined'
16
+ * @param defaultValue The default value to return if the vector is 'undefined'
17
+ * @returns The created vector from the point and the origin or default
16
18
  */
17
- export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
19
+ export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
18
20
  /**
19
21
  * Cross product is a binary operation on two vectors in 2D space.
20
22
  * It results in a vector that is perpendicular to both vectors.
@@ -86,3 +88,7 @@ export declare function vectorMagnitude(v: Vector): number;
86
88
  * @returns The new normalized vector
87
89
  */
88
90
  export declare const vectorNormalize: (v: Vector) => Vector;
91
+ /**
92
+ * Calculate the right-hand normal of the vector.
93
+ */
94
+ export declare const vectorNormal: (v: Vector) => Vector;
@@ -1,5 +1,5 @@
1
1
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
- import type { Bounds } from "@excalidraw/element/bounds";
2
+ import type { Bounds } from "@excalidraw/element";
3
3
  export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
4
4
  export declare function getBBox<P extends LocalPoint | GlobalPoint>(line: LineSegment<P>): Bounds;
5
5
  export declare function doBBoxesIntersect(a: Bounds, b: Bounds): boolean;
@@ -1,4 +1,4 @@
1
1
  export * from "./export";
2
2
  export * from "./withinBounds";
3
3
  export * from "./bbox";
4
- export { getCommonBounds } from "@excalidraw/element/bounds";
4
+ export { getCommonBounds } from "@excalidraw/element";
@@ -1,4 +1,4 @@
1
- import type { Bounds } from "@excalidraw/element/bounds";
1
+ import type { Bounds } from "@excalidraw/element";
2
2
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  type Element = NonDeletedExcalidrawElement;
4
4
  type Elements = readonly NonDeletedExcalidrawElement[];