@excalidraw/element 0.18.0-508de2f3a → 0.18.0-51ad895

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 (109) hide show
  1. package/dist/dev/index.js +2832 -2005
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +17 -17
  4. package/dist/types/common/src/constants.d.ts +20 -15
  5. package/dist/types/common/src/editorInterface.d.ts +34 -0
  6. package/dist/types/common/src/index.d.ts +2 -0
  7. package/dist/types/common/src/utils.d.ts +9 -3
  8. package/dist/types/common/src/visualdebug.d.ts +41 -0
  9. package/dist/types/element/src/binding.d.ts +55 -43
  10. package/dist/types/element/src/bounds.d.ts +1 -1
  11. package/dist/types/element/src/collision.d.ts +6 -2
  12. package/dist/types/element/src/delta.d.ts +4 -5
  13. package/dist/types/element/src/index.d.ts +1 -3
  14. package/dist/types/element/src/linearElementEditor.d.ts +15 -18
  15. package/dist/types/element/src/mutateElement.d.ts +0 -1
  16. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  17. package/dist/types/element/src/renderElement.d.ts +5 -2
  18. package/dist/types/element/src/resizeTest.d.ts +5 -4
  19. package/dist/types/element/src/store.d.ts +5 -0
  20. package/dist/types/element/src/textElement.d.ts +1 -1
  21. package/dist/types/element/src/transformHandles.d.ts +5 -4
  22. package/dist/types/element/src/typeChecks.d.ts +2 -3
  23. package/dist/types/element/src/types.d.ts +7 -11
  24. package/dist/types/element/src/utils.d.ts +2 -1
  25. package/dist/types/element/src/zindex.d.ts +7 -1
  26. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +34 -13
  27. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  28. package/dist/types/excalidraw/actions/actionBoundText.d.ts +25 -11
  29. package/dist/types/excalidraw/actions/actionCanvas.d.ts +153 -262
  30. package/dist/types/excalidraw/actions/actionClipboard.d.ts +46 -773
  31. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -5
  32. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +42 -23
  33. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  34. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/actionElementLink.d.ts +11 -6
  36. package/dist/types/excalidraw/actions/actionElementLock.d.ts +23 -9
  37. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +12 -5
  38. package/dist/types/excalidraw/actions/actionExport.d.ts +68 -943
  39. package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -393
  40. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -2
  41. package/dist/types/excalidraw/actions/actionFrame.d.ts +50 -24
  42. package/dist/types/excalidraw/actions/actionGroup.d.ts +24 -10
  43. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +22 -19
  44. package/dist/types/excalidraw/actions/actionLink.d.ts +9 -2
  45. package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -371
  46. package/dist/types/excalidraw/actions/actionNavigate.d.ts +21 -359
  47. package/dist/types/excalidraw/actions/actionProperties.d.ts +87 -2403
  48. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +12 -5
  49. package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -6
  50. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  51. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +11 -4
  52. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -4
  53. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -5
  54. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  55. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -4
  56. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +11 -4
  57. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +12 -5
  58. package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -2
  59. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  60. package/dist/types/excalidraw/actions/manager.d.ts +1 -1
  61. package/dist/types/excalidraw/actions/register.d.ts +1 -1
  62. package/dist/types/excalidraw/actions/types.d.ts +4 -4
  63. package/dist/types/excalidraw/appState.d.ts +9 -4
  64. package/dist/types/excalidraw/clipboard.d.ts +64 -1
  65. package/dist/types/excalidraw/components/Actions.d.ts +21 -4
  66. package/dist/types/excalidraw/components/App.d.ts +36 -27
  67. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
  68. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
  69. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
  70. package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  71. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
  72. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  73. package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
  74. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  75. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  76. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  77. package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
  78. package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
  79. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  80. package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
  81. package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
  82. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  83. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  84. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  85. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  86. package/dist/types/excalidraw/components/TextField.d.ts +1 -0
  87. package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
  88. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
  89. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  90. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  91. package/dist/types/excalidraw/components/icons.d.ts +10 -0
  92. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +13 -1
  93. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  94. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  95. package/dist/types/excalidraw/data/blob.d.ts +3 -7
  96. package/dist/types/excalidraw/data/restore.d.ts +3 -3
  97. package/dist/types/excalidraw/data/types.d.ts +4 -1
  98. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  99. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
  100. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  101. package/dist/types/excalidraw/index.d.ts +2 -3
  102. package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
  103. package/dist/types/excalidraw/renderer/helpers.d.ts +1 -5
  104. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
  105. package/dist/types/excalidraw/scene/types.d.ts +15 -3
  106. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  107. package/dist/types/excalidraw/types.d.ts +32 -21
  108. package/dist/types/math/src/segment.d.ts +1 -0
  109. package/package.json +3 -3
@@ -1,13 +1,5 @@
1
1
  import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
2
2
  import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
3
- export declare const isDarwin: boolean;
4
- export declare const isWindows: boolean;
5
- export declare const isAndroid: boolean;
6
- export declare const isFirefox: boolean;
7
- export declare const isChrome: boolean;
8
- export declare const isSafari: boolean;
9
- export declare const isIOS: boolean;
10
- export declare const isBrave: () => boolean;
11
3
  export declare const supportsResizeObserver: boolean;
12
4
  export declare const APP_NAME = "Excalidraw";
13
5
  export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
@@ -86,10 +78,13 @@ export declare const ENV: {
86
78
  PRODUCTION: string;
87
79
  };
88
80
  export declare const CLASSES: {
81
+ SIDEBAR: string;
89
82
  SHAPE_ACTIONS_MENU: string;
90
83
  ZOOM_ACTIONS: string;
91
84
  SEARCH_MENU_INPUT_WRAPPER: string;
92
85
  CONVERT_ELEMENT_TYPE_POPUP: string;
86
+ SHAPE_ACTIONS_THEME_SCOPE: string;
87
+ FRAME_NAME: string;
93
88
  };
94
89
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
95
90
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -175,6 +170,14 @@ export declare const IMAGE_MIME_TYPES: {
175
170
  readonly avif: "image/avif";
176
171
  readonly jfif: "image/jfif";
177
172
  };
173
+ export declare const STRING_MIME_TYPES: {
174
+ readonly text: "text/plain";
175
+ readonly html: "text/html";
176
+ readonly json: "application/json";
177
+ readonly excalidraw: "application/vnd.excalidraw+json";
178
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
179
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
180
+ };
178
181
  export declare const MIME_TYPES: {
179
182
  readonly svg: "image/svg+xml";
180
183
  readonly png: "image/png";
@@ -185,14 +188,15 @@ export declare const MIME_TYPES: {
185
188
  readonly ico: "image/x-icon";
186
189
  readonly avif: "image/avif";
187
190
  readonly jfif: "image/jfif";
191
+ readonly "excalidraw.svg": "image/svg+xml";
192
+ readonly "excalidraw.png": "image/png";
193
+ readonly binary: "application/octet-stream";
188
194
  readonly text: "text/plain";
189
195
  readonly html: "text/html";
190
196
  readonly json: "application/json";
191
197
  readonly excalidraw: "application/vnd.excalidraw+json";
192
198
  readonly excalidrawlib: "application/vnd.excalidrawlib+json";
193
- readonly "excalidraw.svg": "image/svg+xml";
194
- readonly "excalidraw.png": "image/png";
195
- readonly binary: "application/octet-stream";
199
+ readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
196
200
  };
197
201
  export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
198
202
  export declare const EXPORT_IMAGE_TYPES: {
@@ -227,10 +231,6 @@ export declare const URL_HASH_KEYS: {
227
231
  readonly addLibrary: "addLibrary";
228
232
  };
229
233
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
230
- export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
231
- export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
232
- export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
233
- export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
234
234
  export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
235
235
  export declare const EXPORT_SCALES: number[];
236
236
  export declare const DEFAULT_EXPORT_PADDING = 10;
@@ -342,3 +342,8 @@ export declare enum UserIdleState {
342
342
  * the start and end points)
343
343
  */
344
344
  export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
345
+ export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
346
+ export declare const BIND_MODE_TIMEOUT = 700;
347
+ export declare const MOBILE_ACTION_BUTTON_BG: {
348
+ readonly background: "var(--mobile-action-button-bg)";
349
+ };
@@ -0,0 +1,34 @@
1
+ export type StylesPanelMode = "compact" | "full" | "mobile";
2
+ export type EditorInterface = Readonly<{
3
+ formFactor: "phone" | "tablet" | "desktop";
4
+ desktopUIMode: "compact" | "full";
5
+ userAgent: Readonly<{
6
+ isMobileDevice: boolean;
7
+ platform: "ios" | "android" | "other" | "unknown";
8
+ }>;
9
+ isTouchScreen: boolean;
10
+ canFitSidebar: boolean;
11
+ isLandscape: boolean;
12
+ }>;
13
+ export declare const MQ_MAX_MOBILE = 599;
14
+ export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
15
+ export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
16
+ export declare const MQ_MIN_TABLET: number;
17
+ export declare const MQ_MAX_TABLET = 1400;
18
+ export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
19
+ export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
20
+ export declare const isDarwin: boolean;
21
+ export declare const isWindows: boolean;
22
+ export declare const isAndroid: boolean;
23
+ export declare const isFirefox: boolean;
24
+ export declare const isChrome: boolean;
25
+ export declare const isSafari: boolean;
26
+ export declare const isIOS: boolean;
27
+ export declare const isBrave: () => boolean;
28
+ export declare const isMobileBreakpoint: (width: number, height: number) => boolean;
29
+ export declare const isTabletBreakpoint: (editorWidth: number, editorHeight: number) => boolean;
30
+ export declare const getFormFactor: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
31
+ export declare const deriveStylesPanelMode: (editorInterface: EditorInterface) => StylesPanelMode;
32
+ export declare const createUserAgentDescriptor: (userAgentString: string) => EditorInterface["userAgent"];
33
+ export declare const loadDesktopUIModePreference: () => "compact" | "full" | null;
34
+ export declare const setDesktopUIMode: (mode: EditorInterface["desktopUIMode"]) => "compact" | "full" | undefined;
@@ -10,3 +10,5 @@ export * from "./random";
10
10
  export * from "./url";
11
11
  export * from "./utils";
12
12
  export * from "./emitter";
13
+ export * from "./visualdebug";
14
+ export * from "./editorInterface";
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
1
+ import type { FontFamilyValues, FontString } from "@excalidraw/element/types";
2
2
  import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
3
3
  import type { MaybePromise } from "./utility-types";
4
4
  import type { EVENT } from "./constants";
@@ -17,6 +17,8 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
17
17
  fontSize: number;
18
18
  fontFamily: FontFamilyValues;
19
19
  }) => FontString;
20
+ /** executes callback in the frame that's after the current one */
21
+ export declare const nextAnimationFrame: (cb: () => any) => Promise<void>;
20
22
  export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
21
23
  (...args: T): void;
22
24
  flush(): void;
@@ -80,6 +82,7 @@ export declare const chunk: <T extends unknown>(array: readonly T[], size: numbe
80
82
  export declare const selectNode: (node: Element) => void;
81
83
  export declare const removeSelection: () => void;
82
84
  export declare const distance: (x: number, y: number) => number;
85
+ export declare const isSelectionLikeTool: (type: ToolType | "custom") => boolean;
83
86
  export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: (({
84
87
  type: ToolType;
85
88
  } | {
@@ -94,7 +97,6 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
94
97
  export declare const isFullScreen: () => boolean;
95
98
  export declare const allowFullScreen: () => Promise<void>;
96
99
  export declare const exitFullScreen: () => Promise<void>;
97
- export declare const getShortcutKey: (shortcut: string) => string;
98
100
  export declare const viewportCoordsToSceneCoords: ({ clientX, clientY }: {
99
101
  clientX: number;
100
102
  clientY: number;
@@ -140,7 +142,6 @@ export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, in
140
142
  /** returns the first non-null mapped value */
141
143
  export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
142
144
  export declare const isTransparent: (color: string) => boolean;
143
- export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
144
145
  export type ResolvablePromise<T> = Promise<T> & {
145
146
  resolve: [T] extends [undefined] ? (value?: MaybePromise<Awaited<T>>) => void : (value: MaybePromise<Awaited<T>>) => void;
146
147
  reject: (error: Error) => void;
@@ -264,4 +265,9 @@ export declare const castArray: <T>(value: T | T[]) => T[];
264
265
  export declare const isReadonlyArray: (value?: any) => value is readonly any[];
265
266
  export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
266
267
  export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
268
+ type FEATURE_FLAGS = {
269
+ COMPLEX_BINDINGS: boolean;
270
+ };
271
+ export declare const getFeatureFlag: <F extends "COMPLEX_BINDINGS">(flag: F) => FEATURE_FLAGS[F];
272
+ export declare const setFeatureFlag: <F extends "COMPLEX_BINDINGS">(flag: F, value: FEATURE_FLAGS[F]) => void;
267
273
  export {};
@@ -0,0 +1,41 @@
1
+ import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
+ import type { Curve } from "@excalidraw/math";
3
+ import type { LineSegment } from "@excalidraw/utils";
4
+ import type { Bounds } from "@excalidraw/element";
5
+ declare global {
6
+ interface Window {
7
+ visualDebug?: {
8
+ data: DebugElement[][];
9
+ currentFrame?: number;
10
+ };
11
+ }
12
+ }
13
+ export type DebugElement = {
14
+ color: string;
15
+ data: LineSegment<GlobalPoint> | Curve<GlobalPoint>;
16
+ permanent: boolean;
17
+ };
18
+ export declare const debugDrawCubicBezier: (c: Curve<GlobalPoint>, opts?: {
19
+ color?: string;
20
+ permanent?: boolean;
21
+ }) => void;
22
+ export declare const debugDrawLine: (segment: LineSegment<GlobalPoint> | LineSegment<GlobalPoint>[], opts?: {
23
+ color?: string;
24
+ permanent?: boolean;
25
+ }) => void;
26
+ export declare const debugDrawPoint: (p: GlobalPoint, opts?: {
27
+ color?: string;
28
+ permanent?: boolean;
29
+ fuzzy?: boolean;
30
+ }) => void;
31
+ export declare const debugDrawBounds: (box: Bounds | Bounds[], opts?: {
32
+ color?: string;
33
+ permanent?: boolean;
34
+ }) => void;
35
+ export declare const debugDrawPoints: ({ x, y, points, }: {
36
+ x: number;
37
+ y: number;
38
+ points: readonly LocalPoint[];
39
+ }, options?: any) => void;
40
+ export declare const debugCloseFrame: () => void;
41
+ export declare const debugClear: () => void;
@@ -1,68 +1,80 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
- import type { LocalPoint } from "@excalidraw/math";
2
+ import type { LineSegment, LocalPoint } from "@excalidraw/math";
3
3
  import type { AppState } from "@excalidraw/excalidraw/types";
4
4
  import { type Heading } from "./heading";
5
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, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
9
- export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
- export type SuggestedPointBinding = [
11
- NonDeleted<ExcalidrawLinearElement>,
12
- "start" | "end" | "both",
13
- NonDeleted<ExcalidrawBindableElement>
14
- ];
8
+ import type { BindMode, ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, ExcalidrawElbowArrowElement, ExcalidrawElement, FixedPoint, FixedPointBinding, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered, PointsPositionUpdates } from "./types";
9
+ export type BindingStrategy = {
10
+ mode: BindMode;
11
+ element: NonDeleted<ExcalidrawBindableElement>;
12
+ focusPoint: GlobalPoint;
13
+ } | {
14
+ mode: null;
15
+ element?: undefined;
16
+ focusPoint?: undefined;
17
+ } | {
18
+ mode: undefined;
19
+ element?: undefined;
20
+ focusPoint?: undefined;
21
+ };
22
+ /**
23
+ * gaps exclude element strokeWidth
24
+ *
25
+ * IMPORTANT: currently must be > 0 (this also applies to the computed gap)
26
+ */
27
+ export declare const BASE_BINDING_GAP = 10;
28
+ export declare const BASE_BINDING_GAP_ELBOW = 5;
29
+ export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
30
+ export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
15
31
  export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
16
32
  export declare const isBindingEnabled: (appState: AppState) => boolean;
17
- export declare const FIXED_BINDING_DISTANCE = 5;
18
- export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
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;
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[];
26
- export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
27
- x: number;
28
- y: number;
29
- }, scene: Scene) => void;
30
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
31
- export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
32
- export declare const getHoveredElementForBinding: (pointerCoords: {
33
- x: number;
34
- y: number;
35
- }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
33
+ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, scene: Scene, appState: AppState, opts?: {
34
+ newArrow?: boolean;
35
+ altKey?: boolean;
36
+ initialBinding?: boolean;
37
+ }) => {
38
+ start: BindingStrategy;
39
+ end: BindingStrategy;
40
+ };
41
+ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arrow: NonDeleted<ExcalidrawArrowElement>, draggingPoints: PointsPositionUpdates, elementsMap: NonDeletedSceneElementsMap, elements: readonly Ordered<NonDeletedExcalidrawElement>[], appState: AppState, opts?: {
42
+ newArrow?: boolean;
43
+ shiftKey?: boolean;
44
+ altKey?: boolean;
45
+ finalize?: boolean;
46
+ initialBinding?: boolean;
47
+ zoom?: AppState["zoom"];
48
+ }) => {
49
+ start: BindingStrategy;
50
+ end: BindingStrategy;
51
+ };
52
+ export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
53
+ export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint) => void;
54
+ export declare const unbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
36
55
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
37
56
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
38
- newSize?: {
39
- width: number;
40
- height: number;
41
- };
42
57
  changedElements?: Map<string, ExcalidrawElement>;
43
58
  }) => void;
44
- export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
59
+ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, appState: AppState, options?: {
45
60
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
46
61
  newSize?: {
47
62
  width: number;
48
63
  height: number;
49
64
  };
50
- zoom?: AppState["zoom"];
51
65
  }) => void;
52
66
  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;
67
+ export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => GlobalPoint;
68
+ export declare const avoidRectangularCorner: (arrowElement: ExcalidrawArrowElement, bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
69
+ export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "startBinding" | "endBinding", binding: FixedPointBinding | null | undefined, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => LocalPoint | null;
56
70
  export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
57
71
  fixedPoint: FixedPoint;
58
72
  };
73
+ export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
74
+ fixedPoint: FixedPoint;
75
+ };
59
76
  export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
60
77
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
61
- export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
62
- x: number;
63
- y: number;
64
- }, elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => boolean;
65
- export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number, zoom?: AppState["zoom"]) => number;
66
78
  export declare const bindingProperties: Set<BindableProp | BindingProp>;
67
79
  export type BindableProp = "boundElements";
68
80
  export type BindingProp = "frameId" | "containerId" | "startBinding" | "endBinding";
@@ -104,7 +116,7 @@ export declare class BindableElement {
104
116
  */
105
117
  static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
106
118
  }
107
- export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
108
- export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
119
+ export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: FixedPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
120
+ export declare const getGlobalFixedPoints: (arrow: ExcalidrawArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
109
121
  export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
110
122
  export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
@@ -74,7 +74,7 @@ export interface BoundingBox {
74
74
  width: number;
75
75
  height: number;
76
76
  }
77
- export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
77
+ export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
78
78
  /**
79
79
  * returns scene coords of user's editor viewport (visible canvas area) bounds
80
80
  */
@@ -1,6 +1,6 @@
1
1
  import type { GlobalPoint, LineSegment } from "@excalidraw/math";
2
2
  import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
3
- import type { ElementsMap, ExcalidrawElement } from "./types";
3
+ import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap, Ordered } from "./types";
4
4
  export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
5
5
  export type HitTestArgs = {
6
6
  point: GlobalPoint;
@@ -8,11 +8,14 @@ export type HitTestArgs = {
8
8
  threshold: number;
9
9
  elementsMap: ElementsMap;
10
10
  frameNameBound?: FrameNameBounds | null;
11
+ overrideShouldTestInside?: boolean;
11
12
  };
12
- export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
13
+ export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, overrideShouldTestInside, }: HitTestArgs) => boolean;
13
14
  export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
14
15
  export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
15
16
  export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
17
+ export declare const getAllHoveredElementAtPoint: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, toleranceFn?: ((element: ExcalidrawBindableElement) => number) | undefined) => NonDeleted<ExcalidrawBindableElement>[];
18
+ export declare const getHoveredElementForBinding: (point: Readonly<GlobalPoint>, elements: readonly Ordered<NonDeletedExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, toleranceFn?: ((element: ExcalidrawBindableElement) => number) | undefined) => NonDeleted<ExcalidrawBindableElement> | null;
16
19
  /**
17
20
  * Intersect a line with an element for binding test
18
21
  *
@@ -30,3 +33,4 @@ export declare const intersectElementWithLineSegment: (element: ExcalidrawElemen
30
33
  * @returns
31
34
  */
32
35
  export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
36
+ export declare const isBindableElementInsideOtherBindable: (innerElement: ExcalidrawBindableElement, outerElement: ExcalidrawBindableElement, elementsMap: ElementsMap) => boolean;
@@ -32,13 +32,13 @@ export declare class Delta<T> {
32
32
  /**
33
33
  * Merges two deltas into a new one.
34
34
  */
35
- static merge<T>(delta1: Delta<T>, delta2: Delta<T>): Delta<T>;
35
+ static merge<T>(delta1: Delta<T>, delta2: Delta<T>, delta3?: Delta<T>): Delta<T>;
36
36
  /**
37
37
  * Merges deleted and inserted object partials.
38
38
  */
39
39
  static mergeObjects<T extends {
40
40
  [key: string]: unknown;
41
- }>(prev: T, added: T, removed: T): T;
41
+ }>(prev: T, added: T, removed?: T): T;
42
42
  /**
43
43
  * Merges deleted and inserted array partials.
44
44
  */
@@ -105,7 +105,7 @@ export interface DeltaContainer<T> {
105
105
  *
106
106
  * @returns a tuple of the next object `T` with applied `Delta`s, and `boolean`, indicating whether the applied deltas resulted in a visible change.
107
107
  */
108
- applyTo(previous: T, ...options: unknown[]): [T, boolean, ...unknown[]];
108
+ applyTo(previous: T, ...options: unknown[]): [T, boolean];
109
109
  /**
110
110
  * Squashes the current delta with the given one.
111
111
  */
@@ -146,7 +146,6 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
146
146
  type ElementPartial<TElement extends ExcalidrawElement = ExcalidrawElement> = Omit<Partial<Ordered<TElement>>, "id" | "updated" | "seed">;
147
147
  export type ApplyToOptions = {
148
148
  excludedProperties?: Set<keyof ElementPartial>;
149
- skipRedraw?: true;
150
149
  };
151
150
  /**
152
151
  * Elements change is a low level primitive to capture a change between two sets of elements.
@@ -165,6 +164,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
165
164
  private static satisfiesRemoval;
166
165
  private static satisfiesUpdate;
167
166
  private static satisfiesCommmonInvariants;
167
+ private static satisfiesUniqueInvariants;
168
168
  private static validate;
169
169
  /**
170
170
  * Calculates the `Delta`s between the previous and next set of elements.
@@ -224,6 +224,5 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
224
224
  */
225
225
  private static postProcess;
226
226
  private static stripIrrelevantProps;
227
- private static stripVersionProps;
228
227
  }
229
228
  export {};
@@ -11,9 +11,6 @@ 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>[];
13
13
  export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
14
- export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
15
- export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
16
- export declare const clearElementsForLocalStorage: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
17
14
  export * from "./align";
18
15
  export * from "./binding";
19
16
  export * from "./bounds";
@@ -38,6 +35,7 @@ export * from "./image";
38
35
  export * from "./linearElementEditor";
39
36
  export * from "./mutateElement";
40
37
  export * from "./newElement";
38
+ export * from "./positionElementsOnGrid";
41
39
  export * from "./renderElement";
42
40
  export * from "./resizeElements";
43
41
  export * from "./resizeTest";
@@ -4,42 +4,40 @@ import { type Store } from "@excalidraw/element";
4
4
  import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize, Zoom } from "@excalidraw/excalidraw/types";
5
5
  import type { Scene } from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
- import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, PointsPositionUpdates } from "./types";
7
+ import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, FixedPointBinding, ExcalidrawElbowArrowElement, PointsPositionUpdates } from "./types";
8
8
  export declare class LinearElementEditor {
9
9
  readonly elementId: ExcalidrawElement["id"] & {
10
10
  _brand: "excalidrawLinearElementId";
11
11
  };
12
12
  /** indices */
13
13
  readonly selectedPointsIndices: readonly number[] | null;
14
- readonly pointerDownState: Readonly<{
14
+ readonly initialState: Readonly<{
15
15
  prevSelectedPointsIndices: readonly number[] | null;
16
16
  /** index */
17
17
  lastClickedPoint: number;
18
- lastClickedIsEndPoint: boolean;
19
- origin: Readonly<{
20
- x: number;
21
- y: number;
22
- }> | null;
18
+ origin: Readonly<GlobalPoint> | null;
23
19
  segmentMidpoint: {
24
20
  value: GlobalPoint | null;
25
21
  index: number | null;
26
22
  added: boolean;
27
23
  };
24
+ arrowStartIsInside: boolean;
25
+ altFocusPoint: Readonly<GlobalPoint> | null;
28
26
  }>;
29
27
  /** whether you're dragging a point */
30
28
  readonly isDragging: boolean;
31
29
  readonly lastUncommittedPoint: LocalPoint | null;
30
+ readonly lastCommittedPoint: LocalPoint | null;
32
31
  readonly pointerOffset: Readonly<{
33
32
  x: number;
34
33
  y: number;
35
34
  }>;
36
- readonly startBindingElement: ExcalidrawBindableElement | null | "keep";
37
- readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
38
35
  readonly hoverPointIndex: number;
39
36
  readonly segmentMidPointHoveredCoords: GlobalPoint | null;
40
37
  readonly elbowed: boolean;
41
38
  readonly customLineAngle: number | null;
42
39
  readonly isEditing: boolean;
40
+ readonly pointerDownState: never;
43
41
  constructor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, isEditing?: boolean);
44
42
  static POINT_HANDLE_SIZE: number;
45
43
  /**
@@ -48,10 +46,8 @@ export declare class LinearElementEditor {
48
46
  */
49
47
  static getElement<T extends ExcalidrawLinearElement>(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): T | null;
50
48
  static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"], elementsMap: NonDeletedSceneElementsMap): false | undefined;
51
- /**
52
- * @returns whether point was dragged
53
- */
54
- static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, keyof AppState> | null;
49
+ static handlePointerMove(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, "suggestedBinding" | "selectedLinearElement"> | null;
50
+ static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor): Pick<AppState, "suggestedBinding" | "selectedLinearElement"> | null;
55
51
  static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, scene: Scene): LinearElementEditor;
56
52
  static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (GlobalPoint | null)[];
57
53
  static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
@@ -70,7 +66,7 @@ export declare class LinearElementEditor {
70
66
  linearElementEditor: LinearElementEditor | null;
71
67
  };
72
68
  static arePointsEqual<Point extends LocalPoint | GlobalPoint>(point1: Point | null, point2: Point | null): boolean;
73
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties): LinearElementEditor | null;
69
+ static handlePointerMoveInEditMode(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties): LinearElementEditor | null;
74
70
  /** scene coords */
75
71
  static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, p: LocalPoint, elementsMap: ElementsMap): GlobalPoint;
76
72
  /** scene coords */
@@ -96,12 +92,13 @@ export declare class LinearElementEditor {
96
92
  static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, app: AppClassProperties, pointIndices: readonly number[]): void;
97
93
  static addPoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, addedPoints: LocalPoint[]): void;
98
94
  static movePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, pointUpdates: PointsPositionUpdates, otherUpdates?: {
99
- startBinding?: PointBinding | null;
100
- endBinding?: PointBinding | null;
95
+ startBinding?: FixedPointBinding | null;
96
+ endBinding?: FixedPointBinding | null;
97
+ moveMidPointsWithElement?: boolean | null;
101
98
  }): void;
102
99
  static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
103
100
  static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, scene: Scene): {
104
- pointerDownState: LinearElementEditor["pointerDownState"];
101
+ pointerDownState: LinearElementEditor["initialState"];
105
102
  selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
106
103
  } | undefined;
107
104
  private static _updatePoints;
@@ -112,6 +109,6 @@ export declare class LinearElementEditor {
112
109
  };
113
110
  static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
114
111
  static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
115
- static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, scene: Scene): LinearElementEditor;
112
+ static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, scene: Scene): Pick<LinearElementEditor, "segmentMidPointHoveredCoords" | "initialState">;
116
113
  static deleteFixedSegment(element: ExcalidrawElbowArrowElement, scene: Scene, index: number): void;
117
114
  }
@@ -11,7 +11,6 @@ export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TEl
11
11
  */
12
12
  export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, elementsMap: ElementsMap, updates: ElementUpdate<TElement>, options?: {
13
13
  isDragging?: boolean;
14
- force?: boolean;
15
14
  }) => TElement;
16
15
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>, force?: boolean) => TElement;
17
16
  /**
@@ -0,0 +1,2 @@
1
+ import type { ExcalidrawElement } from "./types";
2
+ export declare const positionElementsOnGrid: <TElement extends ExcalidrawElement>(elements: TElement[] | TElement[][], centerX: number, centerY: number, padding?: number) => TElement[];
@@ -1,6 +1,7 @@
1
+ import { type GlobalPoint } from "@excalidraw/math";
1
2
  import type { AppState, StaticCanvasAppState, InteractiveCanvasAppState, ElementsPendingErasure, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
2
3
  import type { StaticCanvasRenderConfig, RenderableElementsMap, InteractiveCanvasRenderConfig } from "@excalidraw/excalidraw/scene/types";
3
- import type { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawImageElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap } from "./types";
4
+ import type { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawImageElement, ExcalidrawFrameLikeElement, NonDeletedSceneElementsMap, ElementsMap } from "./types";
4
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
5
6
  export declare const IMAGE_INVERT_FILTER = "invert(100%) hue-rotate(180deg) saturate(1.25)";
6
7
  export declare const getRenderOpacity: (element: ExcalidrawElement, containingFrame: ExcalidrawFrameLikeElement | null, elementsPendingErasure: ElementsPendingErasure, pendingNodes: Readonly<PendingExcalidrawElements> | null, globalAlpha?: number) => number;
@@ -21,8 +22,10 @@ export interface ExcalidrawElementWithCanvas {
21
22
  export declare const DEFAULT_LINK_SIZE = 14;
22
23
  export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
23
24
  export declare const renderSelectionElement: (element: NonDeletedExcalidrawElement, context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState, selectionColor: InteractiveCanvasRenderConfig["selectionColor"]) => void;
24
- export declare const renderElement: (element: NonDeletedExcalidrawElement, elementsMap: RenderableElementsMap, allElementsMap: NonDeletedSceneElementsMap, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
25
+ export declare const renderElement: (element: NonDeletedExcalidrawElement, elementsMap: RenderableElementsMap, allElementsMap: NonDeletedSceneElementsMap, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState | InteractiveCanvasAppState) => void;
25
26
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
26
27
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
27
28
  export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
28
29
  export declare function getFreeDrawSvgPath(element: ExcalidrawFreeDrawElement): string;
30
+ export declare function getFreedrawOutlineAsSegments(element: ExcalidrawFreeDrawElement, points: [number, number][], elementsMap: ElementsMap): import("@excalidraw/math").LineSegment<GlobalPoint>[];
31
+ export declare function getFreedrawOutlinePoints(element: ExcalidrawFreeDrawElement): [number, number][];
@@ -1,14 +1,15 @@
1
+ import { type EditorInterface } from "@excalidraw/common";
1
2
  import type { GlobalPoint, LocalPoint } from "@excalidraw/math";
2
- import type { AppState, Device, Zoom } from "@excalidraw/excalidraw/types";
3
+ import type { AppState, Zoom } from "@excalidraw/excalidraw/types";
3
4
  import type { Bounds } from "./bounds";
4
5
  import type { MaybeTransformHandleType } from "./transformHandles";
5
6
  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;
7
- export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap, device: Device) => {
7
+ export declare const resizeTest: <Point extends GlobalPoint | LocalPoint>(element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType, editorInterface: EditorInterface) => MaybeTransformHandleType;
8
+ export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap, editorInterface: EditorInterface) => {
8
9
  element: NonDeletedExcalidrawElement;
9
10
  transformHandleType: MaybeTransformHandleType;
10
11
  } | 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;
12
+ export declare const getTransformHandleTypeFromCoords: <Point extends GlobalPoint | LocalPoint>([x1, y1, x2, y2]: Bounds, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, editorInterface: EditorInterface) => MaybeTransformHandleType;
12
13
  export declare const getCursorForResizingElement: (resizingElement: {
13
14
  element?: ExcalidrawElement;
14
15
  transformHandleType: MaybeTransformHandleType;
@@ -170,6 +170,10 @@ export declare class StoreDelta {
170
170
  * Parse and load the delta from the remote payload.
171
171
  */
172
172
  static load({ id, elements: { added, removed, updated }, appState: { delta: appStateDelta }, }: DTO<StoreDelta>): StoreDelta;
173
+ /**
174
+ * Squash the passed deltas into the aggregated delta instance.
175
+ */
176
+ static squash(...deltas: StoreDelta[]): StoreDelta;
173
177
  /**
174
178
  * Inverse store delta, creates new instance of `StoreDelta`.
175
179
  */
@@ -182,6 +186,7 @@ export declare class StoreDelta {
182
186
  * Apply latest (remote) changes to the delta, creates new instance of `StoreDelta`.
183
187
  */
184
188
  static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): StoreDelta;
189
+ static empty(): StoreDelta;
185
190
  isEmpty(): boolean;
186
191
  }
187
192
  /**