@excalidraw/excalidraw 0.18.0-6fc8502 → 0.18.0-a18b139

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 (90) hide show
  1. package/dist/dev/{chunk-H7XJ5UVD.js → chunk-MJMGTOVG.js} +2 -2
  2. package/dist/dev/{chunk-KYBDXI6F.js → chunk-U3G3LY5D.js} +5304 -5762
  3. package/dist/dev/chunk-U3G3LY5D.js.map +7 -0
  4. package/dist/dev/data/{image-NKFINVKH.js → image-Y366K5SN.js} +3 -3
  5. package/dist/dev/index.js +1090 -730
  6. package/dist/dev/index.js.map +4 -4
  7. package/dist/dev/subset-shared.chunk.js +1 -1
  8. package/dist/dev/subset-worker.chunk.js +1 -1
  9. package/dist/prod/chunk-PUQLEN73.js +33 -0
  10. package/dist/prod/{chunk-KJYFYP64.js → chunk-VQA74LVG.js} +1 -1
  11. package/dist/prod/data/image-WY2VMQLG.js +1 -0
  12. package/dist/prod/index.js +17 -17
  13. package/dist/prod/subset-shared.chunk.js +1 -1
  14. package/dist/prod/subset-worker.chunk.js +1 -1
  15. package/dist/types/common/src/constants.d.ts +2 -0
  16. package/dist/types/common/src/utils.d.ts +7 -1
  17. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +8 -11
  18. package/dist/types/element/src/align.d.ts +3 -3
  19. package/dist/types/element/src/binding.d.ts +10 -11
  20. package/dist/types/element/src/bounds.d.ts +2 -2
  21. package/dist/types/element/src/collision.d.ts +1 -1
  22. package/dist/types/element/src/dragElements.d.ts +3 -2
  23. package/dist/types/element/src/duplicate.d.ts +10 -13
  24. package/dist/types/element/src/elbowArrow.d.ts +1 -1
  25. package/dist/types/element/src/flowchart.d.ts +3 -2
  26. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  27. package/dist/types/element/src/frame.d.ts +2 -2
  28. package/dist/types/element/src/linearElementEditor.d.ts +13 -13
  29. package/dist/types/element/src/mutateElement.d.ts +10 -2
  30. package/dist/types/element/src/resizeElements.d.ts +4 -4
  31. package/dist/types/element/src/selection.d.ts +11 -0
  32. package/dist/types/element/src/sizeHelpers.d.ts +0 -1
  33. package/dist/types/element/src/textElement.d.ts +5 -3
  34. package/dist/types/element/src/zindex.d.ts +3 -3
  35. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
  36. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -2
  37. package/dist/types/excalidraw/actions/actionCanvas.d.ts +27 -27
  38. package/dist/types/excalidraw/actions/actionClipboard.d.ts +6 -6
  39. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
  40. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
  41. package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -1
  42. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  43. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  44. package/dist/types/excalidraw/actions/actionExport.d.ts +31 -31
  45. package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -2
  46. package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -4
  47. package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
  48. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -1
  49. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
  50. package/dist/types/excalidraw/actions/actionNavigate.d.ts +1 -1
  51. package/dist/types/excalidraw/actions/actionProperties.d.ts +17 -17
  52. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
  53. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -1
  54. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
  55. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
  56. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -2
  57. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
  58. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
  59. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
  60. package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -2
  61. package/dist/types/excalidraw/appState.d.ts +15 -15
  62. package/dist/types/excalidraw/components/App.d.ts +15 -4
  63. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  64. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  65. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  66. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  67. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  68. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  69. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  70. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  71. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  72. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  73. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  74. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -4
  75. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  76. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  77. package/dist/types/excalidraw/eraser/index.d.ts +14 -0
  78. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  79. package/dist/types/excalidraw/lasso/utils.d.ts +1 -2
  80. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
  81. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  82. package/dist/types/excalidraw/scene/types.d.ts +2 -0
  83. package/dist/types/excalidraw/types.d.ts +6 -0
  84. package/dist/types/math/src/types.d.ts +1 -0
  85. package/package.json +1 -1
  86. package/dist/dev/chunk-KYBDXI6F.js.map +0 -7
  87. package/dist/prod/chunk-CAN5RS4P.js +0 -31
  88. package/dist/prod/data/image-5XD47O4X.js +0 -1
  89. /package/dist/dev/{chunk-H7XJ5UVD.js.map → chunk-MJMGTOVG.js.map} +0 -0
  90. /package/dist/dev/data/{image-NKFINVKH.js.map → image-Y366K5SN.js.map} +0 -0
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-KJYFYP64.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-VQA74LVG.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-KJYFYP64.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-VQA74LVG.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};
@@ -82,6 +82,7 @@ export declare const YOUTUBE_STATES: {
82
82
  export declare const ENV: {
83
83
  TEST: string;
84
84
  DEVELOPMENT: string;
85
+ PRODUCTION: string;
85
86
  };
86
87
  export declare const CLASSES: {
87
88
  SHAPE_ACTIONS_MENU: string;
@@ -224,6 +225,7 @@ export declare const DEFAULT_EXPORT_PADDING = 10;
224
225
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
225
226
  export declare const MAX_ALLOWED_FILE_BYTES: number;
226
227
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
228
+ export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
227
229
  export declare const ENCRYPTION_KEY_BITS = 128;
228
230
  export declare const VERSIONS: {
229
231
  readonly excalidraw: 2;
@@ -1,4 +1,5 @@
1
- import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
1
+ import { type GlobalPoint } from "@excalidraw/math";
2
+ import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
2
3
  import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
3
4
  import type { MaybePromise } from "./utility-types";
4
5
  import type { EVENT } from "./constants";
@@ -179,6 +180,7 @@ export type Node<T> = T & {
179
180
  export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
180
181
  export declare const isTestEnv: () => boolean;
181
182
  export declare const isDevEnv: () => boolean;
183
+ export declare const isProdEnv: () => boolean;
182
184
  export declare const isServerEnv: () => boolean;
183
185
  export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
184
186
  nativeEvent: T;
@@ -248,4 +250,8 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
248
250
  */
249
251
  export declare const escapeDoubleQuotes: (str: string) => string;
250
252
  export declare const castArray: <T>(value: T | T[]) => T[];
253
+ export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
254
+ /** hack for Array.isArray type guard not working with readonly value[] */
255
+ export declare const isReadonlyArray: (value?: any) => value is readonly any[];
256
+ export declare const sizeOf: (value: readonly number[] | Readonly<Map<any, any>> | Record<any, any>) => number;
251
257
  export {};
@@ -1,19 +1,11 @@
1
- import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
1
+ import { type ElementUpdate } from "@excalidraw/element/mutateElement";
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
8
  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;
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
  /**
@@ -75,5 +68,9 @@ declare class Scene {
75
68
  containerId: ExcalidrawElement["id"] | null;
76
69
  }) | 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;
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
76
  export default Scene;
@@ -1,7 +1,7 @@
1
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
2
- import type { ElementsMap, ExcalidrawElement } from "./types";
1
+ import type Scene from "./Scene";
2
+ import type { ExcalidrawElement } from "./types";
3
3
  export interface Alignment {
4
4
  position: "start" | "center" | "end";
5
5
  axis: "x" | "y";
6
6
  }
7
- export declare const alignElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, alignment: Alignment, scene: Scene) => ExcalidrawElement[];
7
+ export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene) => 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, OrderedExcalidrawElement, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
9
9
  export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
10
10
  export type SuggestedPointBinding = [
11
11
  NonDeleted<ExcalidrawLinearElement>,
@@ -17,20 +17,20 @@ 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
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;
20
+ export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
21
+ export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
22
22
  export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
23
23
  export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
24
24
  x: number;
25
25
  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;
26
+ }, scene: Scene) => void;
27
+ export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
28
28
  export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
29
29
  export declare const getHoveredElementForBinding: (pointerCoords: {
30
30
  x: number;
31
31
  y: number;
32
32
  }, 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?: {
33
+ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
34
34
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
35
35
  newSize?: {
36
36
  width: number;
@@ -38,15 +38,14 @@ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawE
38
38
  };
39
39
  changedElements?: Map<string, OrderedExcalidrawElement>;
40
40
  }) => 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;
41
+ export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
42
42
  export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
43
43
  export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
44
44
  export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
45
- export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
45
+ export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => {
46
46
  fixedPoint: FixedPoint;
47
47
  };
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;
48
+ export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
50
49
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
51
50
  export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
52
51
  x: number;
@@ -1,6 +1,6 @@
1
1
  import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
2
2
  import type { AppState } from "@excalidraw/excalidraw/types";
3
- import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
3
+ import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap, ElementsMapOrArray } from "./types";
4
4
  import type { Drawable, Op } from "roughjs/bin/core";
5
5
  export type RectangleBox = {
6
6
  x: number;
@@ -51,7 +51,7 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
51
51
  export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
52
52
  export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
53
53
  export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
54
- export declare const getCommonBounds: (elements: readonly ExcalidrawElement[], elementsMap?: ElementsMap) => Bounds;
54
+ export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
55
55
  export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
56
56
  x: number;
57
57
  y: number;
@@ -1,5 +1,5 @@
1
+ import { type GeometricShape } from "@excalidraw/utils/shape";
1
2
  import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
2
- import type { GeometricShape } from "@excalidraw/utils/shape";
3
3
  import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
4
4
  import type { ElementsMap, ExcalidrawElement } from "./types";
5
5
  export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
@@ -1,6 +1,6 @@
1
1
  import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
2
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
3
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
+ import type Scene from "./Scene";
4
4
  export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
5
5
  x: number;
6
6
  y: number;
@@ -9,7 +9,7 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
9
9
  y: number;
10
10
  }, gridSize: NullableGridSize) => void;
11
11
  export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
12
- export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, widthAspectRatio, originOffset, informMutation, }: {
12
+ export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
13
13
  newElement: NonDeletedExcalidrawElement;
14
14
  elementType: AppState["activeTool"]["type"];
15
15
  originX: number;
@@ -21,6 +21,7 @@ export declare const dragNewElement: ({ newElement, elementType, originX, origin
21
21
  shouldMaintainAspectRatio: boolean;
22
22
  shouldResizeFromCenter: boolean;
23
23
  zoom: NormalizedZoomValue;
24
+ scene: Scene;
24
25
  /** whether to keep given aspect ratio when `isResizeWithSidesSameLength` is
25
26
  true */
26
27
  widthAspectRatio?: number | null | undefined;
@@ -13,13 +13,16 @@ import type { ExcalidrawElement, GroupId } from "./types";
13
13
  * multiple elements at once, share this map
14
14
  * amongst all of them
15
15
  * @param element Element to duplicate
16
- * @param overrides Any element properties to override
17
16
  */
18
- export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, overrides?: Partial<TElement> | undefined, randomizeSeed?: boolean) => Readonly<TElement>;
17
+ export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, randomizeSeed?: boolean) => Readonly<TElement>;
19
18
  export declare const duplicateElements: (opts: {
20
19
  elements: readonly ExcalidrawElement[];
21
20
  randomizeSeed?: boolean | undefined;
22
- overrides?: ((originalElement: ExcalidrawElement) => Partial<ExcalidrawElement>) | undefined;
21
+ overrides?: ((data: {
22
+ duplicateElement: ExcalidrawElement;
23
+ origElement: ExcalidrawElement;
24
+ origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>;
25
+ }) => Partial<ExcalidrawElement>) | undefined;
23
26
  } & ({
24
27
  /**
25
28
  * Duplicates all elements in array.
@@ -42,17 +45,11 @@ export declare const duplicateElements: (opts: {
42
45
  editingGroupId: AppState["editingGroupId"];
43
46
  selectedGroupIds: AppState["selectedGroupIds"];
44
47
  };
45
- /**
46
- * If true, duplicated elements are inserted _before_ specified
47
- * elements. Case: alt-dragging elements to duplicate them.
48
- *
49
- * TODO: remove this once (if) we stop replacing the original element
50
- * with the duplicated one in the scene array.
51
- */
52
- reverseOrder: boolean;
53
48
  })) => {
54
- newElements: ExcalidrawElement[];
55
- elementsWithClones: ExcalidrawElement[];
49
+ duplicatedElements: ExcalidrawElement[];
50
+ duplicateElementsMap: Map<string, ExcalidrawElement>;
51
+ elementsWithDuplicates: ExcalidrawElement[];
52
+ origIdToDuplicateId: Map<string, string>;
56
53
  };
57
54
  /**
58
55
  * Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
@@ -8,7 +8,7 @@ export declare const BASE_PADDING = 40;
8
8
  */
9
9
  export declare const updateElbowArrowPoints: (arrow: Readonly<ExcalidrawElbowArrowElement>, elementsMap: NonDeletedSceneElementsMap, updates: {
10
10
  points?: readonly LocalPoint[];
11
- fixedSegments?: FixedSegment[] | null;
11
+ fixedSegments?: readonly FixedSegment[] | null;
12
12
  startBinding?: FixedPointBinding | null;
13
13
  endBinding?: FixedPointBinding | null;
14
14
  }, options?: {
@@ -1,9 +1,10 @@
1
1
  import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
2
2
  import { type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
3
+ import type Scene from "./Scene";
3
4
  type LinkDirection = "up" | "right" | "down" | "left";
4
5
  export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
5
6
  export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
6
- export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap, appState: AppState, direction: LinkDirection, numberOfNodes: number) => ExcalidrawElement[];
7
+ export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => ExcalidrawElement[];
7
8
  export declare class FlowChartNavigator {
8
9
  isExploring: boolean;
9
10
  private sameLevelNodes;
@@ -18,7 +19,7 @@ export declare class FlowChartCreator {
18
19
  private numberOfNodes;
19
20
  private direction;
20
21
  pendingNodes: PendingExcalidrawElements | null;
21
- createNodes(startNode: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap, appState: AppState, direction: LinkDirection): void;
22
+ createNodes(startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene): void;
22
23
  clear(): void;
23
24
  }
24
25
  export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, OrderedExcalidrawElement } from "./types";
1
+ import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement } from "./types";
2
2
  export declare class InvalidFractionalIndexError extends Error {
3
3
  code: "ELEMENT_HAS_INVALID_INDEX";
4
4
  }
@@ -42,7 +42,7 @@ export declare const orderByFractionalIndex: (elements: OrderedExcalidrawElement
42
42
  * Synchronizes invalid fractional indices of moved elements with the array order by mutating passed elements.
43
43
  * If the synchronization fails or the result is invalid, it fallbacks to `syncInvalidIndices`.
44
44
  */
45
- export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: Map<string, ExcalidrawElement>) => OrderedExcalidrawElement[];
45
+ export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: ElementsMap) => OrderedExcalidrawElement[];
46
46
  /**
47
47
  * Synchronizes all invalid fractional indices with the array order by mutating passed elements.
48
48
  *
@@ -1,8 +1,8 @@
1
- import type { ExcalidrawElementsIncludingDeleted } from "@excalidraw/excalidraw/scene/Scene";
2
1
  import type { AppClassProperties, AppState, StaticCanvasAppState } from "@excalidraw/excalidraw/types";
3
2
  import type { ReadonlySetLike } from "@excalidraw/common/utility-types";
3
+ import type { ExcalidrawElementsIncludingDeleted } from "./Scene";
4
4
  import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
5
- export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
+ export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], origElements: readonly ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
6
6
  export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
7
7
  export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
8
8
  export declare const isElementContainingFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => boolean;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
3
- import Scene from "@excalidraw/excalidraw/scene/Scene";
4
3
  import type { Store } from "@excalidraw/excalidraw/store";
5
4
  import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize, Zoom } from "@excalidraw/excalidraw/types";
5
+ import type Scene from "./Scene";
6
6
  import type { Bounds } from "./bounds";
7
- import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, SceneElementsMap, ExcalidrawElbowArrowElement } from "./types";
7
+ import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement } from "./types";
8
8
  declare const editorMidPointsCache: {
9
9
  version: number | null;
10
10
  points: (GlobalPoint | null)[];
@@ -43,7 +43,7 @@ export declare class LinearElementEditor {
43
43
  readonly hoverPointIndex: number;
44
44
  readonly segmentMidPointHoveredCoords: GlobalPoint | null;
45
45
  readonly elbowed: boolean;
46
- constructor(element: NonDeleted<ExcalidrawLinearElement>);
46
+ constructor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap);
47
47
  static POINT_HANDLE_SIZE: number;
48
48
  /**
49
49
  * @param id the `elementId` from the instance of this class (so that we can
@@ -77,7 +77,7 @@ export declare class LinearElementEditor {
77
77
  linearElementEditor: LinearElementEditor | null;
78
78
  };
79
79
  static arePointsEqual<Point extends LocalPoint | GlobalPoint>(point1: Point | null, point2: Point | null): boolean;
80
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): LinearElementEditor | null;
80
+ static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, app: AppClassProperties): LinearElementEditor | null;
81
81
  /** scene coords */
82
82
  static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, p: LocalPoint, elementsMap: ElementsMap): GlobalPoint;
83
83
  /** scene coords */
@@ -97,22 +97,22 @@ export declare class LinearElementEditor {
97
97
  x: number;
98
98
  y: number;
99
99
  };
100
- static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
101
- static duplicateSelectedPoints(appState: AppState, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): AppState;
102
- static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
103
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
100
+ static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap): void;
101
+ static duplicateSelectedPoints(appState: AppState, scene: Scene): AppState;
102
+ static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, pointIndices: readonly number[]): void;
103
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, targetPoints: {
104
104
  point: LocalPoint;
105
105
  }[]): void;
106
- static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
106
+ static movePoints(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene, targetPoints: {
107
107
  index: number;
108
108
  point: LocalPoint;
109
109
  isDragging?: boolean;
110
110
  }[], otherUpdates?: {
111
111
  startBinding?: PointBinding | null;
112
112
  endBinding?: PointBinding | null;
113
- }, sceneElementsMap?: NonDeletedSceneElementsMap): void;
113
+ }): void;
114
114
  static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
115
- static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, elementsMap: ElementsMap): {
115
+ static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, scene: Scene): {
116
116
  pointerDownState: LinearElementEditor["pointerDownState"];
117
117
  selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
118
118
  } | undefined;
@@ -124,7 +124,7 @@ export declare class LinearElementEditor {
124
124
  };
125
125
  static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
126
126
  static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
127
- static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, elementsMap: ElementsMap): LinearElementEditor;
128
- static deleteFixedSegment(element: ExcalidrawElbowArrowElement, index: number): void;
127
+ static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, scene: Scene): LinearElementEditor;
128
+ static deleteFixedSegment(element: ExcalidrawElbowArrowElement, scene: Scene, index: number): void;
129
129
  }
130
130
  export {};
@@ -1,7 +1,15 @@
1
1
  import type { Mutable } from "@excalidraw/common/utility-types";
2
- import type { ExcalidrawElement } from "./types";
2
+ import type { ElementsMap, ExcalidrawElement } from "./types";
3
3
  export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
4
- export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean, options?: {
4
+ /**
5
+ * This function tracks updates of text elements for the purposes for collaboration.
6
+ * The version is used to compare updates when more than one user is working in
7
+ * the same drawing.
8
+ *
9
+ * WARNING: this won't trigger the component to update, so if you need to trigger component update,
10
+ * use `scene.mutateElement` or `ExcalidrawImperativeAPI.mutateElement` instead.
11
+ */
12
+ export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, elementsMap: ElementsMap, updates: ElementUpdate<TElement>, options?: {
5
13
  isDragging?: boolean;
6
14
  }) => TElement;
7
15
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>, force?: boolean) => TElement;
@@ -1,10 +1,10 @@
1
1
  import { type LocalPoint } from "@excalidraw/math";
2
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
3
2
  import type { PointerDownState } from "@excalidraw/excalidraw/types";
3
+ import type Scene from "./Scene";
4
4
  import type { BoundingBox } from "./bounds";
5
5
  import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
6
- import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap, SceneElementsMap } from "./types";
7
- export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: SceneElementsMap, scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
6
+ import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap } from "./types";
7
+ export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
8
8
  export declare const rescalePointsInElement: (element: NonDeletedExcalidrawElement, width: number, height: number, normalizePoints: boolean) => {
9
9
  points: LocalPoint[];
10
10
  } | {
@@ -15,7 +15,7 @@ export declare const measureFontSizeFromWidth: (element: NonDeleted<ExcalidrawTe
15
15
  } | null;
16
16
  export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
17
17
  export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
18
- export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, elementsMap: ElementsMap, originalElementsMap: ElementsMap, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
18
+ export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, originalElementsMap: ElementsMap, scene: Scene, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
19
19
  shouldMaintainAspectRatio?: boolean | undefined;
20
20
  shouldResizeFromCenter?: boolean | undefined;
21
21
  shouldInformMutation?: boolean | undefined;
@@ -1,4 +1,5 @@
1
1
  import type { AppState, InteractiveCanvasAppState } from "@excalidraw/excalidraw/types";
2
+ import { LinearElementEditor } from "./linearElementEditor";
2
3
  import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "./types";
3
4
  /**
4
5
  * Frames and their containing elements are not to be selected at the same time.
@@ -30,3 +31,13 @@ export declare const getTargetElements: (elements: ElementsMapOrArray, appState:
30
31
  export declare const makeNextSelectedElementIds: (nextSelectedElementIds: AppState["selectedElementIds"], prevState: Pick<AppState, "selectedElementIds">) => Readonly<{
31
32
  [id: string]: true;
32
33
  }>;
34
+ export declare const getSelectionStateForElements: (targetElements: readonly ExcalidrawElement[], allElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => {
35
+ editingGroupId: string | null;
36
+ selectedElementIds: Readonly<{
37
+ [id: string]: true;
38
+ }>;
39
+ selectedGroupIds: {
40
+ [groupId: string]: boolean;
41
+ };
42
+ selectedLinearElement: LinearElementEditor | null;
43
+ };
@@ -26,7 +26,6 @@ export declare const getLockedLinearCursorAlignSize: (originX: number, originY:
26
26
  width: number;
27
27
  height: number;
28
28
  };
29
- export declare const resizePerfectLineForNWHandler: (element: ExcalidrawElement, x: number, y: number) => void;
30
29
  export declare const getNormalizedDimensions: (element: Pick<ExcalidrawElement, "width" | "height" | "x" | "y">) => {
31
30
  width: ExcalidrawElement["width"];
32
31
  height: ExcalidrawElement["height"];
@@ -1,9 +1,11 @@
1
1
  import type { AppState } from "@excalidraw/excalidraw/types";
2
2
  import type { ExtractSetType } from "@excalidraw/common/utility-types";
3
+ import type { Radians } from "@excalidraw/math";
4
+ import type Scene from "./Scene";
3
5
  import type { MaybeTransformHandleType } from "./transformHandles";
4
6
  import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeletedExcalidrawElement } from "./types";
5
- export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap, informMutation?: boolean) => void;
6
- export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
7
+ export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
8
+ export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
7
9
  export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
8
10
  x: number;
9
11
  y: number;
@@ -19,7 +21,7 @@ export declare const getContainerCoords: (container: NonDeletedExcalidrawElement
19
21
  x: number;
20
22
  y: number;
21
23
  };
22
- export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => import("../../math/src").Radians;
24
+ export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => 0 | Radians;
23
25
  export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
24
26
  x: number;
25
27
  y: number;
@@ -1,7 +1,7 @@
1
1
  import type { AppState } from "@excalidraw/excalidraw/types";
2
- import type Scene from "@excalidraw/excalidraw/scene/Scene";
2
+ import type Scene from "./Scene";
3
3
  import type { ExcalidrawElement } from "./types";
4
4
  export declare const moveOneLeft: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
5
5
  export declare const moveOneRight: (allElements: readonly ExcalidrawElement[], appState: AppState, scene: Scene) => readonly ExcalidrawElement[];
6
- export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];
7
- export declare const moveAllRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => readonly ExcalidrawElement[] | ExcalidrawElement[];
6
+ export declare const moveAllLeft: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[] | readonly ExcalidrawElement[];
7
+ export declare const moveAllRight: (allElements: readonly ExcalidrawElement[], appState: AppState) => ExcalidrawElement[] | readonly ExcalidrawElement[];
@@ -77,7 +77,7 @@ export declare const actionAddToLibrary: {
77
77
  zoom: Readonly<{
78
78
  value: import("../types").NormalizedZoomValue;
79
79
  }>;
80
- openMenu: "shape" | "canvas" | null;
80
+ openMenu: "canvas" | "shape" | null;
81
81
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
82
82
  openSidebar: {
83
83
  name: string;
@@ -248,7 +248,7 @@ export declare const actionAddToLibrary: {
248
248
  zoom: Readonly<{
249
249
  value: import("../types").NormalizedZoomValue;
250
250
  }>;
251
- openMenu: "shape" | "canvas" | null;
251
+ openMenu: "canvas" | "shape" | null;
252
252
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
253
253
  openSidebar: {
254
254
  name: string;
@@ -424,7 +424,7 @@ export declare const actionAddToLibrary: {
424
424
  zoom: Readonly<{
425
425
  value: import("../types").NormalizedZoomValue;
426
426
  }>;
427
- openMenu: "shape" | "canvas" | null;
427
+ openMenu: "canvas" | "shape" | null;
428
428
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
429
429
  openSidebar: {
430
430
  name: string;
@@ -97,7 +97,7 @@ export declare const actionBindText: {
97
97
  zoom: Readonly<{
98
98
  value: import("../types").NormalizedZoomValue;
99
99
  }>;
100
- openMenu: "shape" | "canvas" | null;
100
+ openMenu: "canvas" | "shape" | null;
101
101
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
102
102
  openSidebar: {
103
103
  name: string;
@@ -285,7 +285,7 @@ export declare const actionWrapTextInContainer: {
285
285
  zoom: Readonly<{
286
286
  value: import("../types").NormalizedZoomValue;
287
287
  }>;
288
- openMenu: "shape" | "canvas" | null;
288
+ openMenu: "canvas" | "shape" | null;
289
289
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
290
290
  openSidebar: {
291
291
  name: string;