@excalidraw/excalidraw 0.18.0-58f7d33 → 0.18.0-6d870b1c8

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 (174) 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-D5WIFFIO.js +5678 -0
  4. package/dist/dev/chunk-D5WIFFIO.js.map +7 -0
  5. package/dist/dev/{chunk-X3RYHLJU.js → chunk-QF5FRM6O.js} +15 -5
  6. package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
  7. package/dist/dev/data/{image-U2IPNUKJ.js → image-WMAXQLTI.js} +3 -3
  8. package/dist/dev/index.css +104 -22
  9. package/dist/dev/index.css.map +3 -3
  10. package/dist/dev/index.js +8871 -9726
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-CKWC2GMK.js → en-SMAPCEOQ.js} +2 -2
  13. package/dist/dev/subset-shared.chunk.js +1 -1
  14. package/dist/dev/subset-worker.chunk.js +1 -1
  15. package/dist/prod/chunk-A66AFZZU.js +7 -0
  16. package/dist/prod/chunk-I4UNSFV6.js +12 -0
  17. package/dist/prod/chunk-KK52DCS3.js +4 -0
  18. package/dist/prod/data/image-U3WTNYT7.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-TYY6KWIJ.js} +1 -1
  22. package/dist/prod/subset-shared.chunk.js +1 -1
  23. package/dist/prod/subset-worker.chunk.js +1 -1
  24. package/dist/types/common/src/constants.d.ts +21 -3
  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 +17 -4
  30. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +11 -14
  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 +13 -5
  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} +74 -39
  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 +43 -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/resizeElements.d.ts +5 -4
  51. package/dist/types/element/src/selection.d.ts +11 -5
  52. package/dist/types/element/src/shape.d.ts +42 -0
  53. package/dist/types/element/src/sizeHelpers.d.ts +2 -2
  54. package/dist/types/element/src/store.d.ts +232 -0
  55. package/dist/types/element/src/textElement.d.ts +4 -3
  56. package/dist/types/element/src/typeChecks.d.ts +19 -1
  57. package/dist/types/element/src/types.d.ts +15 -2
  58. package/dist/types/element/src/utils.d.ts +16 -6
  59. package/dist/types/element/src/zindex.d.ts +1 -1
  60. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +39 -51
  61. package/dist/types/excalidraw/actions/actionBoundText.d.ts +26 -34
  62. package/dist/types/excalidraw/actions/actionCanvas.d.ts +175 -227
  63. package/dist/types/excalidraw/actions/actionClipboard.d.ts +78 -100
  64. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +13 -17
  65. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +39 -50
  66. package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -16
  67. package/dist/types/excalidraw/actions/actionElementLock.d.ts +41 -50
  68. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +13 -17
  69. package/dist/types/excalidraw/actions/actionExport.d.ts +127 -163
  70. package/dist/types/excalidraw/actions/actionFinalize.d.ts +73 -40
  71. package/dist/types/excalidraw/actions/actionFrame.d.ts +99 -115
  72. package/dist/types/excalidraw/actions/actionGroup.d.ts +26 -34
  73. package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
  74. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +538 -18
  75. package/dist/types/excalidraw/actions/actionLink.d.ts +12 -16
  76. package/dist/types/excalidraw/actions/actionMenu.d.ts +36 -48
  77. package/dist/types/excalidraw/actions/actionNavigate.d.ts +25 -33
  78. package/dist/types/excalidraw/actions/actionProperties.d.ts +203 -255
  79. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +13 -17
  80. package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -17
  81. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +13 -17
  82. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -17
  83. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +12 -189
  84. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  85. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -17
  86. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +13 -17
  87. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -17
  88. package/dist/types/excalidraw/actions/types.d.ts +4 -3
  89. package/dist/types/excalidraw/appState.d.ts +19 -10
  90. package/dist/types/excalidraw/components/Actions.d.ts +0 -4
  91. package/dist/types/excalidraw/components/App.d.ts +30 -19
  92. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  93. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  94. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
  95. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  96. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
  97. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
  98. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
  99. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  100. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  101. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  102. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  103. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  104. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  105. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  106. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  107. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  108. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  109. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  110. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  111. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  112. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  113. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  114. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  115. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  116. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  117. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  118. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  119. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  120. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  121. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  122. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  123. package/dist/types/excalidraw/components/icons.d.ts +3 -0
  124. package/dist/types/excalidraw/components/shapes.d.ts +1 -1
  125. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  126. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  127. package/dist/types/excalidraw/data/transform.d.ts +1 -1
  128. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  129. package/dist/types/excalidraw/eraser/index.d.ts +0 -2
  130. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  131. package/dist/types/excalidraw/history.d.ts +30 -22
  132. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  133. package/dist/types/excalidraw/index.d.ts +11 -10
  134. package/dist/types/excalidraw/lasso/index.d.ts +1 -0
  135. package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
  136. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
  137. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  138. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
  139. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  140. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  141. package/dist/types/excalidraw/scene/types.d.ts +2 -0
  142. package/dist/types/excalidraw/snapping.d.ts +2 -2
  143. package/dist/types/excalidraw/types.d.ts +34 -14
  144. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  145. package/dist/types/math/src/angle.d.ts +2 -0
  146. package/dist/types/math/src/constants.d.ts +3 -0
  147. package/dist/types/math/src/curve.d.ts +34 -0
  148. package/dist/types/math/src/index.d.ts +1 -0
  149. package/dist/types/math/src/point.d.ts +1 -1
  150. package/dist/types/math/src/rectangle.d.ts +2 -0
  151. package/dist/types/math/src/vector.d.ts +8 -2
  152. package/dist/types/utils/src/bbox.d.ts +1 -1
  153. package/dist/types/utils/src/index.d.ts +1 -1
  154. package/dist/types/utils/src/withinBounds.d.ts +1 -1
  155. package/history.ts +147 -110
  156. package/package.json +12 -9
  157. package/dist/dev/chunk-KKJLIRJU.js +0 -7
  158. package/dist/dev/chunk-KKJLIRJU.js.map +0 -7
  159. package/dist/dev/chunk-LEJJ2YZY.js +0 -18711
  160. package/dist/dev/chunk-LEJJ2YZY.js.map +0 -7
  161. package/dist/dev/chunk-X3RYHLJU.js.map +0 -7
  162. package/dist/prod/chunk-IUH5AXLB.js +0 -12
  163. package/dist/prod/chunk-QUX7WTVH.js +0 -7
  164. package/dist/prod/chunk-RQK6WG4F.js +0 -33
  165. package/dist/prod/data/image-UQDATCXC.js +0 -1
  166. package/dist/types/element/src/Shape.d.ts +0 -17
  167. package/dist/types/element/src/ShapeCache.d.ts +0 -25
  168. package/dist/types/element/src/shapes.d.ts +0 -23
  169. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  170. package/dist/types/excalidraw/store.d.ts +0 -129
  171. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  172. package/dist/types/utils/src/collision.d.ts +0 -8
  173. /package/dist/dev/data/{image-U2IPNUKJ.js.map → image-WMAXQLTI.js.map} +0 -0
  174. /package/dist/dev/locales/{en-CKWC2GMK.js.map → en-SMAPCEOQ.js.map} +0 -0
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-IUH5AXLB.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,s as clearCanvasDialog,C as colorPicker,A as colors,I as commandPalette,v as confirmDialog,J as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,G as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,F as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,H as userList,B as welcomeScreen};
1
+ import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-I4UNSFV6.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,s as clearCanvasDialog,C as colorPicker,A as colors,I as commandPalette,v as confirmDialog,J as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,G as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,F as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,H as userList,B as welcomeScreen};
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-QUX7WTVH.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-A66AFZZU.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-QUX7WTVH.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-A66AFZZU.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -12,6 +12,7 @@ export declare const supportsResizeObserver: boolean;
12
12
  export declare const APP_NAME = "Excalidraw";
13
13
  export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
14
14
  export declare const DRAGGING_THRESHOLD = 10;
15
+ export declare const MINIMUM_ARROW_SIZE = 20;
15
16
  export declare const LINE_CONFIRM_THRESHOLD = 8;
16
17
  export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
17
18
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
@@ -88,6 +89,7 @@ export declare const CLASSES: {
88
89
  SHAPE_ACTIONS_MENU: string;
89
90
  ZOOM_ACTIONS: string;
90
91
  SEARCH_MENU_INPUT_WRAPPER: string;
92
+ CONVERT_ELEMENT_TYPE_POPUP: string;
91
93
  };
92
94
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
93
95
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -108,11 +110,21 @@ export declare const FONT_FAMILY: {
108
110
  "Lilita One": number;
109
111
  "Comic Shanns": number;
110
112
  "Liberation Sans": number;
113
+ Assistant: number;
114
+ };
115
+ export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
116
+ export declare const MONOSPACE_GENERIC_FONT = "monospace";
117
+ export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
118
+ "sans-serif": number;
119
+ monospace: number;
111
120
  };
112
121
  export declare const FONT_FAMILY_FALLBACKS: {
113
- Xiaolai: number;
114
122
  "Segoe UI Emoji": number;
123
+ "sans-serif": number;
124
+ monospace: number;
125
+ Xiaolai: number;
115
126
  };
127
+ export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
116
128
  export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
117
129
  export declare const THEME: {
118
130
  readonly LIGHT: "light";
@@ -194,7 +206,7 @@ export declare const EXPORT_DATA_TYPES: {
194
206
  readonly excalidrawLibrary: "excalidrawlib";
195
207
  readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
196
208
  };
197
- export declare const EXPORT_SOURCE: string;
209
+ export declare const getExportSource: () => string;
198
210
  export declare const IMAGE_RENDER_TIMEOUT = 500;
199
211
  export declare const TAP_TWICE_TIMEOUT = 300;
200
212
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -278,7 +290,7 @@ export declare const DEFAULT_SIDEBAR: {
278
290
  readonly name: "default";
279
291
  readonly defaultTab: "library";
280
292
  };
281
- export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image" | "iframe">;
293
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
282
294
  export declare const TOOL_TYPE: {
283
295
  readonly selection: "selection";
284
296
  readonly lasso: "lasso";
@@ -324,3 +336,9 @@ export declare enum UserIdleState {
324
336
  AWAY = "away",
325
337
  IDLE = "idle"
326
338
  }
339
+ /**
340
+ * distance at which we merge points instead of adding a new merge-point
341
+ * when converting a line to a polygon (merge currently means overlaping
342
+ * the start and end points)
343
+ */
344
+ export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
@@ -1,4 +1,4 @@
1
- import type { UnsubscribeCallback } from "./types";
1
+ import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
2
2
  type Subscriber<T extends any[]> = (...payload: T) => void;
3
3
  export declare class Emitter<T extends any[] = []> {
4
4
  subscribers: Subscriber<T>[];
@@ -16,8 +16,10 @@ export interface FontMetadata {
16
16
  };
17
17
  /** flag to indicate a deprecated font */
18
18
  deprecated?: true;
19
- /** flag to indicate a server-side only font */
20
- serverSide?: true;
19
+ /**
20
+ * whether this is a font that users can use (= shown in font picker)
21
+ */
22
+ private?: true;
21
23
  /** flag to indiccate a local-only font */
22
24
  local?: true;
23
25
  /** flag to indicate a fallback font */
@@ -9,3 +9,4 @@ export * from "./promise-pool";
9
9
  export * from "./random";
10
10
  export * from "./url";
11
11
  export * from "./utils";
12
+ export * from "./emitter";
@@ -31,3 +31,8 @@ export type MakeBrand<T extends string> = {
31
31
  /** Maybe just promise or already fulfilled one! */
32
32
  export type MaybePromise<T> = T | Promise<T>;
33
33
  export type AllPossibleKeys<T> = T extends any ? keyof T : never;
34
+ /** Strip all the methods or functions from a type */
35
+ export type DTO<T> = {
36
+ [K in keyof T as T[K] extends Function ? never : K]: T[K];
37
+ };
38
+ export type MapEntry<M extends Map<any, any>> = M extends Map<infer K, infer V> ? [K, V] : never;
@@ -1,5 +1,4 @@
1
- import { type GlobalPoint } from "@excalidraw/math";
2
- import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
3
2
  import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
4
3
  import type { MaybePromise } from "./utility-types";
5
4
  import type { EVENT } from "./constants";
@@ -138,6 +137,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
138
137
  export declare const muteFSAbortError: (error?: Error) => void;
139
138
  export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
140
139
  export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
140
+ /** returns the first non-null mapped value */
141
+ export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
141
142
  export declare const isTransparent: (color: string) => boolean;
142
143
  export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
143
144
  export type ResolvablePromise<T> = Promise<T> & {
@@ -178,6 +179,15 @@ export type Node<T> = T & {
178
179
  * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
179
180
  */
180
181
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
182
+ /**
183
+ * Converts a readonly array or map into an iterable.
184
+ * Useful for avoiding entry allocations when iterating object / map on each iteration.
185
+ */
186
+ export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
187
+ /**
188
+ * Converts a readonly array or map into an array.
189
+ */
190
+ export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
181
191
  export declare const isTestEnv: () => boolean;
182
192
  export declare const isDevEnv: () => boolean;
183
193
  export declare const isProdEnv: () => boolean;
@@ -187,7 +197,7 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
187
197
  }>;
188
198
  export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
189
199
  export declare const isPrimitive: (val: any) => boolean;
190
- export declare const getFrame: () => "iframe" | "top";
200
+ export declare const getFrame: () => "top" | "iframe";
191
201
  export declare const isRunningInIframe: () => boolean;
192
202
  export declare const isPromiseLike: (value: any) => value is Promise<any>;
193
203
  export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
@@ -250,5 +260,8 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
250
260
  */
251
261
  export declare const escapeDoubleQuotes: (str: string) => string;
252
262
  export declare const castArray: <T>(value: T | T[]) => T[];
253
- export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
263
+ /** hack for Array.isArray type guard not working with readonly value[] */
264
+ export declare const isReadonlyArray: (value?: any) => value is readonly any[];
265
+ export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
266
+ export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
254
267
  export {};
@@ -1,19 +1,11 @@
1
- import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
1
+ import { type ElementUpdate } from "@excalidraw/element";
2
2
  import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "@excalidraw/element/types";
3
- import type { AppState } from "../types";
4
- type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
5
- type ElementKey = ExcalidrawElement | ElementIdKey;
3
+ import type { Mutable } from "@excalidraw/common/utility-types";
4
+ import type { AppState } from "../../excalidraw/types";
6
5
  type SceneStateCallback = () => void;
7
6
  type SceneStateCallbackRemover = () => void;
8
7
  export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
9
- declare class Scene {
10
- private static sceneMapByElement;
11
- private static sceneMapById;
12
- static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
13
- /**
14
- * @deprecated pass down `app.scene` and use it directly
15
- */
16
- static getScene(elementKey: ElementKey): Scene | null;
8
+ export declare class Scene {
17
9
  private callbacks;
18
10
  private nonDeletedElements;
19
11
  private nonDeletedElementsMap;
@@ -35,6 +27,7 @@ declare class Scene {
35
27
  getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
36
28
  getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
37
29
  getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
30
+ constructor(elements?: ElementsMapOrArray | null);
38
31
  getSelectedElements(opts: {
39
32
  selectedElementIds: AppState["selectedElementIds"];
40
33
  /**
@@ -73,7 +66,11 @@ declare class Scene {
73
66
  getElementIndex(elementId: string): number;
74
67
  getContainerElement: (element: (ExcalidrawElement & {
75
68
  containerId: ExcalidrawElement["id"] | null;
76
- }) | null) => import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
69
+ }) | null) => import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
77
70
  getElementsFromId: (id: string) => ExcalidrawElement[];
71
+ mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
72
+ informMutation: boolean;
73
+ isDragging: boolean;
74
+ }): TElement;
78
75
  }
79
- export default Scene;
76
+ export {};
@@ -1,7 +1,8 @@
1
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
2
- import type { ElementsMap, ExcalidrawElement } from "./types";
1
+ import type { AppState } from "@excalidraw/excalidraw/types";
2
+ import type { Scene } from "./Scene";
3
+ import type { ExcalidrawElement } from "./types";
3
4
  export interface Alignment {
4
5
  position: "start" | "center" | "end";
5
6
  axis: "x" | "y";
6
7
  }
7
- export declare const alignElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, alignment: Alignment, scene: Scene) => ExcalidrawElement[];
8
+ export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => ExcalidrawElement[];
@@ -1,11 +1,11 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { LocalPoint } from "@excalidraw/math";
3
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
4
3
  import type { AppState } from "@excalidraw/excalidraw/types";
5
4
  import { type Heading } from "./heading";
5
+ import type { Scene } from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
7
  import type { ElementUpdate } from "./mutateElement";
8
- import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, OrderedExcalidrawElement, ExcalidrawElbowArrowElement, FixedPoint, SceneElementsMap } from "./types";
8
+ import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
9
9
  export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
10
  export type SuggestedPointBinding = [
11
11
  NonDeleted<ExcalidrawLinearElement>,
@@ -16,37 +16,47 @@ export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEv
16
16
  export declare const isBindingEnabled: (appState: AppState) => boolean;
17
17
  export declare const FIXED_BINDING_DISTANCE = 5;
18
18
  export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
19
- export declare const BINDING_HIGHLIGHT_OFFSET = 4;
20
- export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap, scene: Scene) => void;
21
- export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null, zoom?: AppState["zoom"]) => void;
19
+ export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
20
+ export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
22
21
  export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
22
+ export declare const maybeSuggestBindingsForLinearElementAtCoords: (linearElement: NonDeleted<ExcalidrawLinearElement>, pointerCoords: {
23
+ x: number;
24
+ y: number;
25
+ }[], scene: Scene, zoom: AppState["zoom"], oppositeBindingBoundElement?: ExcalidrawBindableElement | null) => ExcalidrawBindableElement[];
23
26
  export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
24
27
  x: number;
25
28
  y: number;
26
- }, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[]) => void;
27
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
29
+ }, scene: Scene) => void;
30
+ export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
28
31
  export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
29
32
  export declare const getHoveredElementForBinding: (pointerCoords: {
30
33
  x: number;
31
34
  y: number;
32
35
  }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
33
- export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, options?: {
36
+ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
37
+ simultaneouslyUpdated?: readonly ExcalidrawElement[];
38
+ newSize?: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ changedElements?: Map<string, ExcalidrawElement>;
43
+ }) => void;
44
+ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
34
45
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
35
46
  newSize?: {
36
47
  width: number;
37
48
  height: number;
38
49
  };
39
- changedElements?: Map<string, OrderedExcalidrawElement>;
50
+ zoom?: AppState["zoom"];
40
51
  }) => void;
41
- export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, elementsMap: ElementsMap, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
42
- export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
43
- export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
44
- export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
52
+ export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
53
+ export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => GlobalPoint;
54
+ export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
55
+ export declare const snapToMid: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number) => GlobalPoint;
45
56
  export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
46
57
  fixedPoint: FixedPoint;
47
58
  };
48
- export declare const fixDuplicatedBindingsAfterDuplication: (newElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatedElementsMap: NonDeletedSceneElementsMap) => void;
49
- export declare const fixReversedBindings: (originalElements: Map<string, ExcalidrawElement>, elementsWithClones: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
59
+ export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
50
60
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
51
61
  export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
52
62
  x: number;
@@ -94,7 +104,7 @@ export declare class BindableElement {
94
104
  */
95
105
  static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
96
106
  }
97
- export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement) => GlobalPoint;
107
+ export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
98
108
  export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
99
109
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
100
110
  export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
@@ -1,7 +1,7 @@
1
- import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
1
+ import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
2
2
  import type { AppState } from "@excalidraw/excalidraw/types";
3
- import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
4
3
  import type { Drawable, Op } from "roughjs/bin/core";
4
+ import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
5
5
  export type RectangleBox = {
6
6
  x: number;
7
7
  y: number;
@@ -26,7 +26,8 @@ export type SceneBounds = readonly [
26
26
  ];
27
27
  export declare class ElementBounds {
28
28
  private static boundsCache;
29
- static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap): Bounds;
29
+ private static nonRotatedBoundsCache;
30
+ static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean): Bounds;
30
31
  private static calculateBounds;
31
32
  }
32
33
  export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
@@ -43,6 +44,7 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
43
44
  */
44
45
  export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
45
46
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
47
+ export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
46
48
  export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((p: GlobalPoint) => GlobalPoint) | undefined) => Bounds;
47
49
  export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
48
50
  /** @returns number in pixels */
@@ -50,8 +52,8 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
50
52
  /** @returns number in degrees */
51
53
  export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
52
54
  export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
53
- export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
54
- export declare const getCommonBounds: (elements: readonly ExcalidrawElement[], elementsMap?: ElementsMap) => Bounds;
55
+ export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
56
+ export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
55
57
  export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
56
58
  x: number;
57
59
  y: number;
@@ -78,4 +80,10 @@ export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | read
78
80
  */
79
81
  export declare const getVisibleSceneBounds: ({ scrollX, scrollY, width, height, zoom, }: AppState) => SceneBounds;
80
82
  export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
83
+ /**
84
+ * Get the axis-aligned bounding box for a given element
85
+ */
86
+ export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
87
+ export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
81
88
  export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
89
+ export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
@@ -1,20 +1,18 @@
1
- import { type GeometricShape } from "@excalidraw/utils/shape";
2
- import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
1
+ import type { GlobalPoint, LineSegment } from "@excalidraw/math";
3
2
  import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
4
3
  import type { ElementsMap, ExcalidrawElement } from "./types";
5
4
  export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
6
- export type HitTestArgs<Point extends GlobalPoint | LocalPoint> = {
7
- x: number;
8
- y: number;
5
+ export type HitTestArgs = {
6
+ point: GlobalPoint;
9
7
  element: ExcalidrawElement;
10
- shape: GeometricShape<Point>;
11
- threshold?: number;
8
+ threshold: number;
9
+ elementsMap: ElementsMap;
12
10
  frameNameBound?: FrameNameBounds | null;
13
11
  };
14
- export declare const hitElementItself: <Point extends GlobalPoint | LocalPoint>({ x, y, element, shape, threshold, frameNameBound, }: HitTestArgs<Point>) => boolean;
15
- export declare const hitElementBoundingBox: (x: number, y: number, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
16
- export declare const hitElementBoundingBoxOnly: <Point extends GlobalPoint | LocalPoint>(hitArgs: HitTestArgs<Point>, elementsMap: ElementsMap) => boolean;
17
- export declare const hitElementBoundText: <Point extends GlobalPoint | LocalPoint>(x: number, y: number, textShape: GeometricShape<Point> | null) => boolean;
12
+ export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
13
+ export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
14
+ export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
15
+ export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
18
16
  /**
19
17
  * Intersect a line with an element for binding test
20
18
  *
@@ -23,4 +21,12 @@ export declare const hitElementBoundText: <Point extends GlobalPoint | LocalPoin
23
21
  * @param offset
24
22
  * @returns
25
23
  */
26
- export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, line: LineSegment<GlobalPoint>, offset?: number) => GlobalPoint[];
24
+ export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, elementsMap: ElementsMap, line: LineSegment<GlobalPoint>, offset?: number, onlyFirst?: boolean) => GlobalPoint[];
25
+ /**
26
+ * Check if the given point is considered inside the element's border
27
+ *
28
+ * @param point
29
+ * @param element
30
+ * @returns
31
+ */
32
+ export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
@@ -1,7 +1,7 @@
1
1
  import type { TransformHandleType } from "./transformHandles";
2
2
  import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
3
3
  export declare const MINIMAL_CROP_SIZE = 10;
4
- export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
4
+ export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
5
5
  x: number;
6
6
  y: number;
7
7
  width: number;