@zsviczian/excalidraw 0.17.1-obsidian-14 → 0.17.1-obsidian-16

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 (74) hide show
  1. package/dist/excalidraw.development.js +118 -96
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +405 -357
  4. package/dist/styles.production.css +12 -12
  5. package/package.json +2 -2
  6. package/types/excalidraw/actions/actionAddToLibrary.d.ts +6 -6
  7. package/types/excalidraw/actions/actionBoundText.d.ts +4 -4
  8. package/types/excalidraw/actions/actionCanvas.d.ts +28 -28
  9. package/types/excalidraw/actions/actionClipboard.d.ts +14 -14
  10. package/types/excalidraw/actions/actionDeleteSelected.d.ts +7 -7
  11. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  12. package/types/excalidraw/actions/actionElementLock.d.ts +4 -4
  13. package/types/excalidraw/actions/actionExport.d.ts +18 -18
  14. package/types/excalidraw/actions/actionFinalize.d.ts +4 -4
  15. package/types/excalidraw/actions/actionFrame.d.ts +6 -6
  16. package/types/excalidraw/actions/actionGroup.d.ts +4 -4
  17. package/types/excalidraw/actions/actionLinearEditor.d.ts +2 -2
  18. package/types/excalidraw/actions/actionLink.d.ts +197 -0
  19. package/types/excalidraw/actions/actionMenu.d.ts +6 -6
  20. package/types/excalidraw/actions/actionNavigate.d.ts +4 -4
  21. package/types/excalidraw/actions/actionProperties.d.ts +26 -26
  22. package/types/excalidraw/actions/actionSelectAll.d.ts +2 -2
  23. package/types/excalidraw/actions/actionStyles.d.ts +2 -2
  24. package/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -2
  25. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -2
  26. package/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  27. package/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -2
  28. package/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -2
  29. package/types/excalidraw/actions/index.d.ts +1 -1
  30. package/types/excalidraw/animated-trail.d.ts +1 -1
  31. package/types/excalidraw/appState.d.ts +1 -1
  32. package/types/excalidraw/components/App.d.ts +3 -0
  33. package/types/excalidraw/components/Button.d.ts +1 -0
  34. package/types/excalidraw/components/FilledButton.d.ts +2 -2
  35. package/types/excalidraw/components/ImageExportDialog.d.ts +2 -1
  36. package/types/excalidraw/components/LaserTool/LaserPathManager.d.ts +28 -0
  37. package/types/excalidraw/components/LaserTool/LaserPointerButton.d.ts +10 -0
  38. package/types/excalidraw/components/LaserTool/LaserTool.d.ts +7 -0
  39. package/types/excalidraw/components/ProjectName.d.ts +0 -1
  40. package/types/excalidraw/components/TextField.d.ts +5 -2
  41. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +18 -0
  42. package/types/excalidraw/components/hyperlink/helpers.d.ts +7 -0
  43. package/types/excalidraw/constants.d.ts +5 -0
  44. package/types/excalidraw/data/filesystem.d.ts +1 -1
  45. package/types/excalidraw/data/index.d.ts +2 -1
  46. package/types/excalidraw/data/json.d.ts +1 -1
  47. package/types/excalidraw/data/resave.d.ts +1 -1
  48. package/types/excalidraw/element/ElementCanvasButtons.d.ts +3 -2
  49. package/types/excalidraw/element/binding.d.ts +9 -9
  50. package/types/excalidraw/element/bounds.d.ts +6 -6
  51. package/types/excalidraw/element/collision.d.ts +8 -8
  52. package/types/excalidraw/element/embeddable.d.ts +2 -2
  53. package/types/excalidraw/element/linearElementEditor.d.ts +30 -30
  54. package/types/excalidraw/element/newElement.d.ts +4 -4
  55. package/types/excalidraw/element/resizeElements.d.ts +1 -1
  56. package/types/excalidraw/element/resizeTest.d.ts +3 -3
  57. package/types/excalidraw/element/sizeHelpers.d.ts +2 -2
  58. package/types/excalidraw/element/textElement.d.ts +5 -5
  59. package/types/excalidraw/element/transformHandles.d.ts +2 -2
  60. package/types/excalidraw/example/App.d.ts +14 -0
  61. package/types/excalidraw/example/CustomFooter.d.ts +5 -0
  62. package/types/excalidraw/example/MobileFooter.d.ts +5 -0
  63. package/types/excalidraw/example/index.d.ts +1 -0
  64. package/types/excalidraw/example/initialData.d.ts +290 -0
  65. package/types/excalidraw/example/sidebar/ExampleSidebar.d.ts +4 -0
  66. package/types/excalidraw/frame.d.ts +11 -11
  67. package/types/excalidraw/history.d.ts +1 -1
  68. package/types/excalidraw/scene/Scene.d.ts +2 -7
  69. package/types/excalidraw/scene/scrollbars.d.ts +3 -2
  70. package/types/excalidraw/scene/selection.d.ts +3 -3
  71. package/types/excalidraw/snapping.d.ts +7 -7
  72. package/types/excalidraw/types.d.ts +5 -3
  73. package/types/excalidraw/vite.config.d.mts +2 -0
  74. package/types/utils/index.d.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
1
+ import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap } from "./types";
2
2
  import { AppState } from "../types";
3
3
  import Scene from "../scene/Scene";
4
4
  export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
@@ -9,26 +9,26 @@ export type SuggestedPointBinding = [
9
9
  ];
10
10
  export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
11
11
  export declare const isBindingEnabled: (appState: AppState) => boolean;
12
- export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep") => void;
13
- export declare const bindOrUnbindSelectedElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
12
+ export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap) => void;
13
+ export declare const bindOrUnbindSelectedElements: (selectedElements: NonDeleted<ExcalidrawElement>[], elements: readonly ExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap) => void;
14
14
  export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, scene: Scene, pointerCoords: {
15
15
  x: number;
16
16
  y: number;
17
- }) => void;
18
- export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => void;
17
+ }, elementsMap: NonDeletedSceneElementsMap) => void;
18
+ export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: NonDeletedSceneElementsMap) => void;
19
19
  export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
20
- export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
20
+ export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap) => void;
21
21
  export declare const getHoveredElementForBinding: (pointerCoords: {
22
22
  x: number;
23
23
  y: number;
24
- }, scene: Scene) => NonDeleted<ExcalidrawBindableElement> | null;
25
- export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, options?: {
24
+ }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap) => NonDeleted<ExcalidrawBindableElement> | null;
25
+ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: ElementsMap, options?: {
26
26
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
27
27
  newSize?: {
28
28
  width: number;
29
29
  height: number;
30
30
  };
31
31
  }) => void;
32
- export declare const getEligibleElementsForBinding: (elements: NonDeleted<ExcalidrawElement>[]) => SuggestedBinding[];
32
+ export declare const getEligibleElementsForBinding: (selectedElements: NonDeleted<ExcalidrawElement>[], elements: readonly ExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap) => SuggestedBinding[];
33
33
  export declare const fixBindingsAfterDuplication: (sceneElements: readonly ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicatesServeAsOld?: "duplicatesServeAsOld" | undefined) => void;
34
34
  export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMapOrArray } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
2
2
  import { Drawable, Op } from "roughjs/bin/core";
3
3
  import { AppState, Point } from "../types";
4
4
  export type RectangleBox = {
@@ -25,11 +25,11 @@ export type SceneBounds = readonly [
25
25
  ];
26
26
  export declare class ElementBounds {
27
27
  private static boundsCache;
28
- static getBounds(element: ExcalidrawElement): Bounds;
28
+ static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap): Bounds;
29
29
  private static calculateBounds;
30
30
  }
31
- export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
32
- export declare const getElementLineSegments: (element: ExcalidrawElement) => [Point, Point][];
31
+ export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
32
+ export declare const getElementLineSegments: (element: ExcalidrawElement, elementsMap: ElementsMap) => [Point, Point][];
33
33
  /**
34
34
  * Scene -> Scene coords, but in x1,x2,y1,y2 format.
35
35
  *
@@ -46,8 +46,8 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
46
46
  /** @returns number in degrees */
47
47
  export declare const getArrowheadAngle: (arrowhead: Arrowhead) => number;
48
48
  export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
49
- export declare const getElementBounds: (element: ExcalidrawElement) => Bounds;
50
- export declare const getCommonBounds: (elements: ElementsMapOrArray) => Bounds;
49
+ export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
50
+ export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => Bounds;
51
51
  export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
52
52
  x: number;
53
53
  y: number;
@@ -4,18 +4,18 @@ import { FrameNameBoundsCache, Point } from "../types";
4
4
  import { AppState } from "../types";
5
5
  export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
6
6
  export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
7
- export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number]) => boolean;
8
- export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
7
+ export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number], elementsMap: ElementsMap) => boolean;
8
+ export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, elementsMap: ElementsMap, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
9
9
  export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
10
10
  x: number;
11
11
  y: number;
12
- }) => boolean;
12
+ }, elementsMap: ElementsMap) => boolean;
13
13
  export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number) => number;
14
- export declare const distanceToBindableElement: (element: ExcalidrawBindableElement, point: readonly [number, number]) => number;
15
- export declare const pointInAbsoluteCoords: (element: ExcalidrawElement, point: readonly [number, number]) => readonly [number, number];
16
- export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number]) => number;
17
- export declare const determineFocusPoint: (element: ExcalidrawBindableElement, focus: number, adjecentPoint: readonly [number, number]) => readonly [number, number];
18
- export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
14
+ export declare const distanceToBindableElement: (element: ExcalidrawBindableElement, point: readonly [number, number], elementsMap: ElementsMap) => number;
15
+ export declare const pointInAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, point: readonly [number, number]) => readonly [number, number];
16
+ export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], elementsMap: ElementsMap) => number;
17
+ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, focus: number, adjecentPoint: readonly [number, number], elementsMap: ElementsMap) => readonly [number, number];
18
+ export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap: number | undefined, elementsMap: ElementsMap) => Point[];
19
19
  export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
20
20
  export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
21
21
  export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
@@ -69,7 +69,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
69
69
  scrollY: number;
70
70
  cursorButton: "up" | "down";
71
71
  scrolledOutside: boolean;
72
- name: string;
72
+ name: string | null;
73
73
  isResizing: boolean;
74
74
  isRotating: boolean;
75
75
  zoom: Readonly<{
@@ -147,7 +147,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
147
147
  data: import("../charts").Spreadsheet;
148
148
  };
149
149
  pendingImageElementId: string | null;
150
- showHyperlinkPopup: false | "editor" | "info";
150
+ showHyperlinkPopup: false | "info" | "editor";
151
151
  linkOpacity: number;
152
152
  trayModeEnabled: boolean;
153
153
  colorPalette?: {
@@ -1,8 +1,7 @@
1
- import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap } from "./types";
1
+ import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "./types";
2
2
  import { Bounds } from "./bounds";
3
3
  import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
4
4
  import History from "../history";
5
- import Scene from "../scene/Scene";
6
5
  declare const editorMidPointsCache: {
7
6
  version: number | null;
8
7
  points: (Point | null)[];
@@ -39,47 +38,48 @@ export declare class LinearElementEditor {
39
38
  readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
40
39
  readonly hoverPointIndex: number;
41
40
  readonly segmentMidPointHoveredCoords: Point | null;
42
- constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
41
+ constructor(element: NonDeleted<ExcalidrawLinearElement>);
43
42
  static POINT_HANDLE_SIZE: number;
44
43
  /**
45
44
  * @param id the `elementId` from the instance of this class (so that we can
46
45
  * statically guarantee this method returns an ExcalidrawLinearElement)
47
46
  */
48
- static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"]): NonDeleted<ExcalidrawLinearElement> | null;
49
- static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"]): false | undefined;
47
+ static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): NonDeleted<ExcalidrawLinearElement> | null;
48
+ static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"], elementsMap: NonDeletedSceneElementsMap): false | undefined;
50
49
  /** @returns whether point was dragged */
51
50
  static handlePointDragging(event: PointerEvent, appState: AppState, scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>, pointSceneCoords: {
52
51
  x: number;
53
52
  y: number;
54
- }[]) => void, linearElementEditor: LinearElementEditor, elementsMap: ElementsMap): boolean;
55
- static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
53
+ }[]) => void, linearElementEditor: LinearElementEditor, elementsMap: NonDeletedSceneElementsMap): boolean;
54
+ static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap): LinearElementEditor;
56
55
  static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
57
- static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => void;
56
+ static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => void;
58
57
  static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
59
58
  x: number;
60
59
  y: number;
61
60
  }, appState: AppState, elementsMap: ElementsMap) => readonly [number, number] | null;
62
61
  static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
63
- static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
62
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number, elementsMap: ElementsMap): readonly [number, number];
64
63
  static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point, elementsMap: ElementsMap): number;
65
64
  static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, history: History, scenePointer: {
66
65
  x: number;
67
66
  y: number;
68
- }, linearElementEditor: LinearElementEditor, elementsMap: ElementsMap): {
67
+ }, linearElementEditor: LinearElementEditor, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap): {
69
68
  didAddPoint: boolean;
70
69
  hitElement: NonDeleted<ExcalidrawElement> | null;
71
70
  linearElementEditor: LinearElementEditor | null;
72
71
  };
73
72
  static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
74
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
73
+ static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState, elementsMap: ElementsMap): LinearElementEditor | null;
75
74
  /** scene coords */
76
- static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
75
+ static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point, elementsMap: ElementsMap): readonly [number, number];
77
76
  /** scene coords */
78
- static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>): Point[];
79
- static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number): Point;
80
- static pointFromAbsoluteCoords(element: NonDeleted<ExcalidrawLinearElement>, absoluteCoords: Point): Point;
81
- static getPointIndexUnderCursor(element: NonDeleted<ExcalidrawLinearElement>, zoom: AppState["zoom"], x: number, y: number): number;
82
- static createPointAt(element: NonDeleted<ExcalidrawLinearElement>, scenePointerX: number, scenePointerY: number, gridSize: number | null): Point;
77
+ static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap): Point[];
78
+ static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number, // -1 for last element
79
+ elementsMap: ElementsMap): Point;
80
+ static pointFromAbsoluteCoords(element: NonDeleted<ExcalidrawLinearElement>, absoluteCoords: Point, elementsMap: ElementsMap): Point;
81
+ static getPointIndexUnderCursor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, zoom: AppState["zoom"], x: number, y: number): number;
82
+ static createPointAt(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, scenePointerX: number, scenePointerY: number, gridSize: number | null): Point;
83
83
  /**
84
84
  * Normalizes line points so that the start point is at [0,0]. This is
85
85
  * expected in various parts of the codebase. Also returns new x/y to account
@@ -91,7 +91,7 @@ export declare class LinearElementEditor {
91
91
  y: number;
92
92
  };
93
93
  static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
94
- static duplicateSelectedPoints(appState: AppState): false | {
94
+ static duplicateSelectedPoints(appState: AppState, elementsMap: ElementsMap): false | {
95
95
  appState: {
96
96
  editingLinearElement: {
97
97
  selectedPointsIndices: number[];
@@ -132,13 +132,13 @@ export declare class LinearElementEditor {
132
132
  isLoading: boolean;
133
133
  errorMessage: import("react").ReactNode;
134
134
  activeEmbeddable: {
135
- element: import("./types").NonDeletedExcalidrawElement;
135
+ element: NonDeletedExcalidrawElement;
136
136
  state: "active" | "hover";
137
137
  } | null;
138
- draggingElement: import("./types").NonDeletedExcalidrawElement | null;
139
- resizingElement: import("./types").NonDeletedExcalidrawElement | null;
138
+ draggingElement: NonDeletedExcalidrawElement | null;
139
+ resizingElement: NonDeletedExcalidrawElement | null;
140
140
  multiElement: NonDeleted<ExcalidrawLinearElement> | null;
141
- selectionElement: import("./types").NonDeletedExcalidrawElement | null;
141
+ selectionElement: NonDeletedExcalidrawElement | null;
142
142
  isBindingEnabled: boolean;
143
143
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
144
144
  suggestedBindings: import("./binding").SuggestedBinding[];
@@ -151,7 +151,7 @@ export declare class LinearElementEditor {
151
151
  };
152
152
  editingFrame: string | null;
153
153
  elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
154
- editingElement: import("./types").NonDeletedExcalidrawElement | null;
154
+ editingElement: NonDeletedExcalidrawElement | null;
155
155
  activeTool: {
156
156
  lastActiveTool: import("../types").ActiveTool | null;
157
157
  locked: boolean;
@@ -180,7 +180,7 @@ export declare class LinearElementEditor {
180
180
  scrollY: number;
181
181
  cursorButton: "up" | "down";
182
182
  scrolledOutside: boolean;
183
- name: string;
183
+ name: string | null;
184
184
  isResizing: boolean;
185
185
  isRotating: boolean;
186
186
  zoom: Readonly<{
@@ -232,7 +232,7 @@ export declare class LinearElementEditor {
232
232
  offsetLeft: number;
233
233
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
234
234
  collaborators: Map<import("../types").SocketId, Readonly<{
235
- pointer?: import("../types").CollaboratorPointer | undefined;
235
+ pointer?: import("../types").CollaboratorPointer | undefined; /** indices */
236
236
  button?: "up" | "down" | undefined;
237
237
  selectedElementIds?: Readonly<{
238
238
  [id: string]: true;
@@ -258,7 +258,7 @@ export declare class LinearElementEditor {
258
258
  data: import("../charts").Spreadsheet;
259
259
  };
260
260
  pendingImageElementId: string | null;
261
- showHyperlinkPopup: false | "editor" | "info";
261
+ showHyperlinkPopup: false | "info" | "editor";
262
262
  linkOpacity: number;
263
263
  trayModeEnabled: boolean;
264
264
  colorPalette?: {
@@ -314,18 +314,18 @@ export declare class LinearElementEditor {
314
314
  startBinding?: PointBinding;
315
315
  endBinding?: PointBinding;
316
316
  }): void;
317
- static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): boolean;
318
- static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean): {
317
+ static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
318
+ static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean, elementsMap: ElementsMap): {
319
319
  pointerDownState: LinearElementEditor["pointerDownState"];
320
320
  selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
321
321
  } | undefined;
322
322
  private static _updatePoints;
323
323
  private static _getShiftLockedDelta;
324
- static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
324
+ static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
325
325
  x: number;
326
326
  y: number;
327
327
  };
328
- static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
328
+ static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
329
329
  static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
330
330
  }
331
331
  export {};
@@ -1,7 +1,7 @@
1
- import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap } from "./types";
2
2
  import { AppState } from "../types";
3
3
  import { MarkOptional, Mutable } from "../utility-types";
4
- export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
4
+ export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
5
5
  export declare const newElement: (opts: {
6
6
  type: ExcalidrawGenericElement["type"];
7
7
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
@@ -28,7 +28,7 @@ export declare const newTextElement: (opts: {
28
28
  lineHeight?: ExcalidrawTextElement["lineHeight"];
29
29
  strokeWidth?: ExcalidrawTextElement["strokeWidth"];
30
30
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
31
- export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, text?: string) => {
31
+ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, text?: string) => {
32
32
  x: number;
33
33
  y: number;
34
34
  width: number;
@@ -36,7 +36,7 @@ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement,
36
36
  baseline: number;
37
37
  text: string;
38
38
  } | undefined;
39
- export declare const updateTextElement: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, { text, isDeleted, originalText, rawText, link, }: {
39
+ export declare const updateTextElement: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, { text, isDeleted, originalText, rawText, link, }: {
40
40
  text: string;
41
41
  isDeleted?: boolean | undefined;
42
42
  originalText: string;
@@ -5,5 +5,5 @@ export declare const normalizeAngle: (angle: number) => number;
5
5
  export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
6
6
  export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
7
7
  export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType: "nw" | "ne" | "sw" | "se", shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
8
- export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
8
+ export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
9
9
  export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
@@ -1,9 +1,9 @@
1
- import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState, Zoom } from "../types";
4
4
  import { Bounds } from "./bounds";
5
- export declare const resizeTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
6
- export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => {
5
+ export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
6
+ export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap) => {
7
7
  element: NonDeletedExcalidrawElement;
8
8
  transformHandleType: MaybeTransformHandleType;
9
9
  } | null;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement } from "./types";
1
+ import { ElementsMap, ExcalidrawElement } from "./types";
2
2
  import { AppState, Zoom } from "../types";
3
3
  export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
4
4
  export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
@@ -7,7 +7,7 @@ export declare const isElementInViewport: (element: ExcalidrawElement, width: nu
7
7
  offsetTop: number;
8
8
  scrollX: number;
9
9
  scrollY: number;
10
- }) => boolean;
10
+ }, elementsMap: ElementsMap) => boolean;
11
11
  /**
12
12
  * Makes a perfect shape or diagonal/horizontal/vertical line
13
13
  */
@@ -3,10 +3,10 @@ import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState } from "../types";
4
4
  import { ExtractSetType } from "../utility-types";
5
5
  export declare const normalizeText: (text: string) => string;
6
- export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
7
- export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
6
+ export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap) => void;
7
+ export declare const bindTextToShapeAfterDuplication: (newElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
8
8
  export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
9
- export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
9
+ export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
10
10
  x: number;
11
11
  y: number;
12
12
  };
@@ -53,13 +53,13 @@ export declare const getContainerCoords: (container: NonDeletedExcalidrawElement
53
53
  y: number;
54
54
  };
55
55
  export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => number;
56
- export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
56
+ export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
57
57
  x: number;
58
58
  y: number;
59
59
  } | undefined;
60
60
  export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
61
61
  export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
62
- export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
62
+ export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number, elementsMap: ElementsMap) => ExcalidrawTextContainer | null;
63
63
  declare const VALID_CONTAINER_TYPES: Set<string>;
64
64
  export declare const isValidTextContainer: (element: {
65
65
  type: ExcalidrawElementType;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
1
+ import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
2
2
  import { Bounds } from "./bounds";
3
3
  import { InteractiveCanvasAppState, Zoom } from "../types";
4
4
  export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
@@ -32,5 +32,5 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
32
32
  se?: boolean | undefined;
33
33
  rotation?: boolean | undefined;
34
34
  }, margin?: number) => TransformHandles;
35
- export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
35
+ export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType) => TransformHandles;
36
36
  export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
@@ -0,0 +1,14 @@
1
+ import type * as TExcalidraw from "../index";
2
+ import "./App.scss";
3
+ import type { ExcalidrawImperativeAPI } from "../types";
4
+ declare global {
5
+ interface Window {
6
+ ExcalidrawLib: typeof TExcalidraw;
7
+ }
8
+ }
9
+ export interface AppProps {
10
+ appTitle: string;
11
+ useCustom: (api: ExcalidrawImperativeAPI | null, customArgs?: any[]) => void;
12
+ customArgs?: any[];
13
+ }
14
+ export default function App({ appTitle, useCustom, customArgs }: AppProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { ExcalidrawImperativeAPI } from "../types";
2
+ declare const CustomFooter: ({ excalidrawAPI, }: {
3
+ excalidrawAPI: ExcalidrawImperativeAPI;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default CustomFooter;
@@ -0,0 +1,5 @@
1
+ import type { ExcalidrawImperativeAPI } from "../types";
2
+ declare const MobileFooter: ({ excalidrawAPI, }: {
3
+ excalidrawAPI: ExcalidrawImperativeAPI;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
5
+ export default MobileFooter;
@@ -0,0 +1 @@
1
+ export {};