@excalidraw/excalidraw 0.18.0-a5d6939 → 0.18.0-a8acc82

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 (184) hide show
  1. package/dist/dev/chunk-6MX365WZ.js +5666 -0
  2. package/dist/dev/chunk-6MX365WZ.js.map +7 -0
  3. package/dist/dev/chunk-CP5DND7P.js +7 -0
  4. package/dist/dev/chunk-CP5DND7P.js.map +7 -0
  5. package/dist/dev/{chunk-X3RYHLJU.js → chunk-QF5FRM6O.js} +15 -5
  6. package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
  7. package/dist/dev/data/{image-JN3Y4CVN.js → image-GQCFJKGM.js} +3 -3
  8. package/dist/dev/index.css +230 -23
  9. package/dist/dev/index.css.map +3 -3
  10. package/dist/dev/index.js +10262 -10068
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-CKWC2GMK.js → en-SMAPCEOQ.js} +2 -2
  13. package/dist/dev/subset-shared.chunk.js +1 -1
  14. package/dist/dev/subset-worker.chunk.js +1 -1
  15. package/dist/prod/chunk-A66AFZZU.js +7 -0
  16. package/dist/prod/chunk-I4UNSFV6.js +12 -0
  17. package/dist/prod/chunk-R2M7VUMD.js +4 -0
  18. package/dist/prod/data/image-JWK7QZ22.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +25 -17
  21. package/dist/prod/locales/{en-SBO6ZHT2.js → en-TYY6KWIJ.js} +1 -1
  22. package/dist/prod/subset-shared.chunk.js +1 -1
  23. package/dist/prod/subset-worker.chunk.js +1 -1
  24. package/dist/types/common/src/constants.d.ts +40 -7
  25. package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  26. package/dist/types/common/src/font-metadata.d.ts +4 -2
  27. package/dist/types/common/src/index.d.ts +1 -0
  28. package/dist/types/common/src/utility-types.d.ts +5 -0
  29. package/dist/types/common/src/utils.d.ts +18 -4
  30. package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
  31. package/dist/types/element/src/align.d.ts +4 -3
  32. package/dist/types/element/src/binding.d.ts +25 -14
  33. package/dist/types/element/src/bounds.d.ts +14 -6
  34. package/dist/types/element/src/collision.d.ts +18 -12
  35. package/dist/types/element/src/cropElement.d.ts +1 -1
  36. package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
  37. package/dist/types/element/src/distance.d.ts +2 -2
  38. package/dist/types/element/src/distribute.d.ts +2 -1
  39. package/dist/types/element/src/dragElements.d.ts +3 -2
  40. package/dist/types/element/src/elbowArrow.d.ts +1 -1
  41. package/dist/types/element/src/flowchart.d.ts +3 -2
  42. package/dist/types/element/src/fractionalIndex.d.ts +9 -3
  43. package/dist/types/element/src/frame.d.ts +4 -3
  44. package/dist/types/element/src/groups.d.ts +1 -0
  45. package/dist/types/element/src/index.d.ts +44 -2
  46. package/dist/types/element/src/linearElementEditor.d.ts +23 -36
  47. package/dist/types/element/src/mutateElement.d.ts +11 -3
  48. package/dist/types/element/src/newElement.d.ts +4 -3
  49. package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
  50. package/dist/types/element/src/renderElement.d.ts +4 -1
  51. package/dist/types/element/src/resizeElements.d.ts +5 -4
  52. package/dist/types/element/src/selection.d.ts +0 -5
  53. package/dist/types/element/src/shape.d.ts +42 -0
  54. package/dist/types/element/src/sizeHelpers.d.ts +2 -2
  55. package/dist/types/element/src/store.d.ts +237 -0
  56. package/dist/types/element/src/textElement.d.ts +4 -3
  57. package/dist/types/element/src/typeChecks.d.ts +19 -1
  58. package/dist/types/element/src/types.d.ts +15 -2
  59. package/dist/types/element/src/utils.d.ts +16 -6
  60. package/dist/types/element/src/zindex.d.ts +1 -1
  61. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +45 -54
  62. package/dist/types/excalidraw/actions/actionBoundText.d.ts +30 -36
  63. package/dist/types/excalidraw/actions/actionCanvas.d.ts +204 -242
  64. package/dist/types/excalidraw/actions/actionClipboard.d.ts +90 -106
  65. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +15 -18
  66. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +45 -53
  67. package/dist/types/excalidraw/actions/actionElementLink.d.ts +14 -17
  68. package/dist/types/excalidraw/actions/actionElementLock.d.ts +45 -52
  69. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +15 -18
  70. package/dist/types/excalidraw/actions/actionExport.d.ts +145 -172
  71. package/dist/types/excalidraw/actions/actionFinalize.d.ts +77 -42
  72. package/dist/types/excalidraw/actions/actionFrame.d.ts +107 -119
  73. package/dist/types/excalidraw/actions/actionGroup.d.ts +30 -36
  74. package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
  75. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +541 -20
  76. package/dist/types/excalidraw/actions/actionLink.d.ts +14 -17
  77. package/dist/types/excalidraw/actions/actionMenu.d.ts +42 -51
  78. package/dist/types/excalidraw/actions/actionNavigate.d.ts +29 -35
  79. package/dist/types/excalidraw/actions/actionProperties.d.ts +246 -274
  80. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +15 -18
  81. package/dist/types/excalidraw/actions/actionStyles.d.ts +15 -18
  82. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +15 -18
  83. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +15 -18
  84. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +14 -190
  85. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  86. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +15 -18
  87. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +15 -18
  88. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +15 -18
  89. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  90. package/dist/types/excalidraw/actions/types.d.ts +4 -3
  91. package/dist/types/excalidraw/appState.d.ts +20 -10
  92. package/dist/types/excalidraw/clipboard.d.ts +64 -1
  93. package/dist/types/excalidraw/components/Actions.d.ts +8 -5
  94. package/dist/types/excalidraw/components/App.d.ts +30 -30
  95. package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  96. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  97. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +7 -2
  98. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  99. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
  100. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
  101. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
  102. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  103. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  104. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  105. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  106. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  107. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  108. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  109. package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +2 -1
  110. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  111. package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  112. package/dist/types/excalidraw/components/Range.d.ts +3 -3
  113. package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  114. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  115. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  116. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  117. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  118. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  119. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  120. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  121. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  122. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  123. package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
  124. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
  125. package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  126. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  127. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  128. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  129. package/dist/types/excalidraw/components/icons.d.ts +9 -0
  130. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  131. package/dist/types/excalidraw/data/blob.d.ts +3 -7
  132. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  133. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  134. package/dist/types/excalidraw/data/transform.d.ts +1 -1
  135. package/dist/types/excalidraw/data/types.d.ts +4 -1
  136. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  137. package/dist/types/excalidraw/eraser/index.d.ts +0 -2
  138. package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
  139. package/dist/types/excalidraw/history.d.ts +30 -22
  140. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  141. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  142. package/dist/types/excalidraw/index.d.ts +11 -10
  143. package/dist/types/excalidraw/lasso/index.d.ts +1 -0
  144. package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
  145. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
  146. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  147. package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
  148. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  149. package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
  150. package/dist/types/excalidraw/scene/types.d.ts +2 -0
  151. package/dist/types/excalidraw/snapping.d.ts +2 -2
  152. package/dist/types/excalidraw/types.d.ts +36 -15
  153. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  154. package/dist/types/math/src/angle.d.ts +2 -0
  155. package/dist/types/math/src/constants.d.ts +3 -0
  156. package/dist/types/math/src/curve.d.ts +34 -0
  157. package/dist/types/math/src/index.d.ts +1 -0
  158. package/dist/types/math/src/point.d.ts +1 -1
  159. package/dist/types/math/src/rectangle.d.ts +2 -0
  160. package/dist/types/math/src/segment.d.ts +1 -0
  161. package/dist/types/math/src/vector.d.ts +8 -2
  162. package/dist/types/utils/src/bbox.d.ts +1 -1
  163. package/dist/types/utils/src/index.d.ts +1 -1
  164. package/dist/types/utils/src/withinBounds.d.ts +1 -1
  165. package/history.ts +146 -109
  166. package/package.json +13 -10
  167. package/dist/dev/chunk-GBJ7S76A.js +0 -18599
  168. package/dist/dev/chunk-GBJ7S76A.js.map +0 -7
  169. package/dist/dev/chunk-GIMGG4AT.js +0 -7
  170. package/dist/dev/chunk-GIMGG4AT.js.map +0 -7
  171. package/dist/dev/chunk-X3RYHLJU.js.map +0 -7
  172. package/dist/prod/chunk-GKI4RZ6C.js +0 -7
  173. package/dist/prod/chunk-IUH5AXLB.js +0 -12
  174. package/dist/prod/chunk-TVF64BAY.js +0 -33
  175. package/dist/prod/data/image-CZ2OEVDB.js +0 -1
  176. package/dist/types/element/src/Shape.d.ts +0 -17
  177. package/dist/types/element/src/ShapeCache.d.ts +0 -25
  178. package/dist/types/element/src/shapes.d.ts +0 -23
  179. package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  180. package/dist/types/excalidraw/store.d.ts +0 -129
  181. package/dist/types/excalidraw/visualdebug.d.ts +0 -41
  182. package/dist/types/utils/src/collision.d.ts +0 -8
  183. /package/dist/dev/data/{image-JN3Y4CVN.js.map → image-GQCFJKGM.js.map} +0 -0
  184. /package/dist/dev/locales/{en-CKWC2GMK.js.map → en-SMAPCEOQ.js.map} +0 -0
@@ -1,16 +1,14 @@
1
1
  import React from "react";
2
- import { type EXPORT_IMAGE_TYPES } from "@excalidraw/common";
3
- import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
- import { FlowChartCreator } from "@excalidraw/element/flowchart";
5
- import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
2
+ import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
3
+ import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
+ import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
+ import type { Mutable } from "@excalidraw/common/utility-types";
6
6
  import { ActionManager } from "../actions/manager";
7
7
  import { AnimationFrameHandler } from "../animation-frame-handler";
8
8
  import { History } from "../history";
9
- import Scene from "../scene/Scene";
10
9
  import { Fonts } from "../fonts";
10
+ import { type WritableAtom } from "../editor-jotai";
11
11
  import { Renderer } from "../scene/Renderer";
12
- import { Emitter } from "../emitter";
13
- import { Store } from "../store";
14
12
  import { LaserTrails } from "../laser-trails";
15
13
  import { LassoTrail } from "../lasso";
16
14
  import { EraserTrail } from "../eraser";
@@ -80,6 +78,7 @@ declare class App extends React.Component<AppProps, AppState> {
80
78
  /** embeds that have been inserted to DOM (as a perf optim, we don't want to
81
79
  * insert to DOM before user initially scrolls to them) */
82
80
  private initializedEmbeds;
81
+ private handleToastClose;
83
82
  private elementsPendingErasure;
84
83
  flowChartCreator: FlowChartCreator;
85
84
  private flowChartNavigator;
@@ -124,7 +123,7 @@ declare class App extends React.Component<AppProps, AppState> {
124
123
  };
125
124
  originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
126
125
  resize: {
127
- handleType: import("@excalidraw/element/transformHandles").MaybeTransformHandleType;
126
+ handleType: import("@excalidraw/element").MaybeTransformHandleType;
128
127
  isResizing: boolean;
129
128
  offset: {
130
129
  x: number;
@@ -154,6 +153,7 @@ declare class App extends React.Component<AppProps, AppState> {
154
153
  x: number;
155
154
  y: number;
156
155
  };
156
+ blockDragging: boolean;
157
157
  };
158
158
  eventListeners: {
159
159
  onMove: {
@@ -166,10 +166,7 @@ declare class App extends React.Component<AppProps, AppState> {
166
166
  onKeyUp: ((event: KeyboardEvent) => void) | null;
167
167
  };
168
168
  boxSelection: {
169
- hasOccurred: boolean; /**
170
- * Returns gridSize taking into account `gridModeEnabled`.
171
- * If disabled, returns null.
172
- */
169
+ hasOccurred: boolean;
173
170
  };
174
171
  }>, event: React.PointerEvent<HTMLElement>]>;
175
172
  onPointerUpEmitter: Emitter<[activeTool: {
@@ -196,7 +193,7 @@ declare class App extends React.Component<AppProps, AppState> {
196
193
  };
197
194
  originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
198
195
  resize: {
199
- handleType: import("@excalidraw/element/transformHandles").MaybeTransformHandleType;
196
+ handleType: import("@excalidraw/element").MaybeTransformHandleType;
200
197
  isResizing: boolean;
201
198
  offset: {
202
199
  x: number;
@@ -226,6 +223,7 @@ declare class App extends React.Component<AppProps, AppState> {
226
223
  x: number;
227
224
  y: number;
228
225
  };
226
+ blockDragging: boolean;
229
227
  };
230
228
  eventListeners: {
231
229
  onMove: {
@@ -238,10 +236,7 @@ declare class App extends React.Component<AppProps, AppState> {
238
236
  onKeyUp: ((event: KeyboardEvent) => void) | null;
239
237
  };
240
238
  boxSelection: {
241
- hasOccurred: boolean; /**
242
- * Returns gridSize taking into account `gridModeEnabled`.
243
- * If disabled, returns null.
244
- */
239
+ hasOccurred: boolean;
245
240
  };
246
241
  }>, event: PointerEvent]>;
247
242
  onUserFollowEmitter: Emitter<[payload: OnUserFollowedPayload]>;
@@ -250,7 +245,9 @@ declare class App extends React.Component<AppProps, AppState> {
250
245
  }>]>;
251
246
  missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
252
247
  onRemoveEventListenersEmitter: Emitter<[]>;
248
+ defaultSelectionTool: "selection" | "lasso";
253
249
  constructor(props: AppProps);
250
+ updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
254
251
  private onWindowMessage;
255
252
  private cacheEmbeddableRef;
256
253
  /**
@@ -272,6 +269,7 @@ declare class App extends React.Component<AppProps, AppState> {
272
269
  render(): import("react/jsx-runtime").JSX.Element;
273
270
  focusContainer: AppClassProperties["focusContainer"];
274
271
  getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
272
+ getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
275
273
  getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
276
274
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
277
275
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
@@ -303,6 +301,7 @@ declare class App extends React.Component<AppProps, AppState> {
303
301
  private resetScene;
304
302
  private initializeScene;
305
303
  private isMobileBreakpoint;
304
+ private isTabletBreakpoint;
306
305
  private refreshViewportBreakpoints;
307
306
  private refreshEditorBreakpoints;
308
307
  private clearImageShapeCache;
@@ -321,6 +320,7 @@ declare class App extends React.Component<AppProps, AppState> {
321
320
  private static resetTapTwice;
322
321
  private onTouchStart;
323
322
  private onTouchEnd;
323
+ private insertClipboardContent;
324
324
  pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
325
325
  addElementsFromPasteOrLibrary: (opts: {
326
326
  elements: readonly ExcalidrawElement[];
@@ -402,6 +402,8 @@ declare class App extends React.Component<AppProps, AppState> {
402
402
  */
403
403
  captureUpdate?: SceneData["captureUpdate"];
404
404
  }) => void;
405
+ applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
406
+ mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
405
407
  private triggerRender;
406
408
  /**
407
409
  * @returns whether the menu was toggled on or off
@@ -416,12 +418,9 @@ declare class App extends React.Component<AppProps, AppState> {
416
418
  private onKeyDown;
417
419
  private onKeyUp;
418
420
  private isToolSupported;
419
- setActiveTool: (tool: (({
420
- type: Exclude<ToolType, "image">;
421
+ setActiveTool: (tool: ({
422
+ type: ToolType;
421
423
  } | {
422
- type: Extract<ToolType, "image">;
423
- insertOnCanvasDirectly?: boolean;
424
- }) | {
425
424
  type: "custom";
426
425
  customType: string;
427
426
  }) & {
@@ -447,7 +446,7 @@ declare class App extends React.Component<AppProps, AppState> {
447
446
  private getTextElementAtPosition;
448
447
  private getElementAtPosition;
449
448
  private getElementsAtPosition;
450
- getElementHitThreshold(): number;
449
+ getElementHitThreshold(element: ExcalidrawElement): number;
451
450
  private hitElement;
452
451
  private getTextBindableContainerAtPosition;
453
452
  private startTextEditing;
@@ -495,7 +494,7 @@ declare class App extends React.Component<AppProps, AppState> {
495
494
  sceneY: number;
496
495
  link: string;
497
496
  }) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
498
- private createImageElement;
497
+ private newImagePlaceholder;
499
498
  private handleLinearElementOnPointerDown;
500
499
  private getCurrentItemRoundness;
501
500
  private createGenericElementOnPointerDown;
@@ -511,12 +510,13 @@ declare class App extends React.Component<AppProps, AppState> {
511
510
  private eraseElements;
512
511
  private initializeImage;
513
512
  /**
514
- * inserts image into elements array and rerenders
513
+ * use during async image initialization,
514
+ * when the placeholder image could have been modified in the meantime,
515
+ * and when you don't want to loose those modifications
515
516
  */
516
- insertImageElement: (imageElement: ExcalidrawImageElement, imageFile: File, showCursorImagePreview?: boolean) => Promise<NonDeleted<InitializedExcalidrawImageElement> | null | undefined>;
517
- private setImagePreviewCursor;
518
- private onImageAction;
519
- initializeImageDimensions: (imageElement: ExcalidrawImageElement, forceNaturalSize?: boolean) => void;
517
+ private getLatestInitializedImageElement;
518
+ private onImageToolbarButtonClick;
519
+ private getImageNaturalDimensions;
520
520
  /** updates image cache, refreshing updated elements and/or setting status
521
521
  to error for images that fail during <img> element creation */
522
522
  private updateImageCache;
@@ -527,9 +527,9 @@ declare class App extends React.Component<AppProps, AppState> {
527
527
  private scheduleImageRefresh;
528
528
  private updateBindingEnabledOnPointerMove;
529
529
  private maybeSuggestBindingAtCursor;
530
- private maybeSuggestBindingsForLinearElementAtCoords;
531
530
  private clearSelection;
532
531
  private handleInteractiveCanvasRef;
532
+ private insertImages;
533
533
  private handleAppOnDrop;
534
534
  loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
535
535
  private handleCanvasContextMenu;
@@ -10,6 +10,7 @@ interface ButtonIconProps {
10
10
  /** include standalone style (could interfere with parent styles) */
11
11
  standalone?: boolean;
12
12
  onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
13
+ style?: React.CSSProperties;
13
14
  }
14
15
  export declare const ButtonIcon: import("react").ForwardRefExoticComponent<ButtonIconProps & import("react").RefAttributes<HTMLButtonElement>>;
15
16
  export {};
@@ -4,6 +4,7 @@ interface ColorInputProps {
4
4
  onChange: (color: string) => void;
5
5
  label: string;
6
6
  colorPickerType: ColorPickerType;
7
+ placeholder?: string;
7
8
  }
8
- export declare const ColorInput: ({ color, onChange, label, colorPickerType, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -6,7 +6,11 @@ import type { AppState } from "../../types";
6
6
  export declare const getColor: (color: string) => string | null;
7
7
  interface ColorPickerProps {
8
8
  type: ColorPickerType;
9
- color: string;
9
+ /**
10
+ * null indicates no color should be displayed as active
11
+ * (e.g. when multiple shapes selected with different colors)
12
+ */
13
+ color: string | null;
10
14
  onChange: (color: string) => void;
11
15
  label: string;
12
16
  elements: readonly ExcalidrawElement[];
@@ -14,6 +18,7 @@ interface ColorPickerProps {
14
18
  palette?: ColorPaletteCustom | null;
15
19
  topPicks?: ColorTuple;
16
20
  updateData: (formData?: any) => void;
21
+ compactMode?: boolean;
17
22
  }
18
- export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, compactMode, }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
19
24
  export {};
@@ -1,6 +1,6 @@
1
1
  interface CustomColorListProps {
2
2
  colors: string[];
3
- color: string;
3
+ color: string | null;
4
4
  onChange: (color: string) => void;
5
5
  label: string;
6
6
  }
@@ -3,9 +3,8 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { ColorPaletteCustom } from "@excalidraw/common";
4
4
  import type { ColorPickerType } from "./colorPickerUtils";
5
5
  interface PickerProps {
6
- color: string;
6
+ color: string | null;
7
7
  onChange: (color: string) => void;
8
- label: string;
9
8
  type: ColorPickerType;
10
9
  elements: readonly ExcalidrawElement[];
11
10
  palette: ColorPaletteCustom;
@@ -14,5 +13,5 @@ interface PickerProps {
14
13
  onEyeDropperToggle: (force?: boolean) => void;
15
14
  onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
16
15
  }
17
- export declare const Picker: ({ color, onChange, label, type, elements, palette, updateData, children, onEyeDropperToggle, onEscape, }: PickerProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
18
17
  export {};
@@ -1,10 +1,9 @@
1
1
  import type { ColorPaletteCustom } from "@excalidraw/common";
2
2
  interface PickerColorListProps {
3
3
  palette: ColorPaletteCustom;
4
- color: string;
4
+ color: string | null;
5
5
  onChange: (color: string) => void;
6
- label: string;
7
6
  activeShade: number;
8
7
  }
9
- declare const PickerColorList: ({ palette, color, onChange, label, activeShade, }: PickerColorListProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const PickerColorList: ({ palette, color, onChange, activeShade, }: PickerColorListProps) => import("react/jsx-runtime").JSX.Element;
10
9
  export default PickerColorList;
@@ -1,8 +1,8 @@
1
1
  import type { ColorPaletteCustom } from "@excalidraw/common";
2
2
  interface ShadeListProps {
3
- hex: string;
3
+ color: string | null;
4
4
  onChange: (color: string) => void;
5
5
  palette: ColorPaletteCustom;
6
6
  }
7
- export declare const ShadeList: ({ hex, onChange, palette }: ShadeListProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const ShadeList: ({ color, onChange, palette }: ShadeListProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -2,7 +2,7 @@ import type { ColorPickerType } from "./colorPickerUtils";
2
2
  interface TopPicksProps {
3
3
  onChange: (color: string) => void;
4
4
  type: ColorPickerType;
5
- activeColor: string;
5
+ activeColor: string | null;
6
6
  topPicks?: readonly string[];
7
7
  }
8
8
  export declare const TopPicks: ({ onChange, type, activeColor, topPicks, }: TopPicksProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -2,7 +2,7 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { ColorPickerColor, ColorPaletteCustom } from "@excalidraw/common";
3
3
  export declare const getColorNameAndShadeFromColor: ({ palette, color, }: {
4
4
  palette: ColorPaletteCustom;
5
- color: string;
5
+ color: string | null;
6
6
  }) => {
7
7
  colorName: ColorPickerColor;
8
8
  shade: number | null;
@@ -5,7 +5,7 @@ interface ColorPickerKeyNavHandlerProps {
5
5
  event: React.KeyboardEvent;
6
6
  activeColorPickerSection: ActiveColorPickerSectionAtomType;
7
7
  palette: ColorPaletteCustom;
8
- color: string;
8
+ color: string | null;
9
9
  onChange: (color: string) => void;
10
10
  customColors: string[];
11
11
  setActiveColorPickerSection: (update: React.SetStateAction<ActiveColorPickerSectionAtomType>) => void;
@@ -0,0 +1,23 @@
1
+ import type { ConvertibleTypes, ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElementWithContainer } from "@excalidraw/element/types";
2
+ import type { Scene } from "@excalidraw/element";
3
+ import "./ConvertElementTypePopup.scss";
4
+ import type App from "./App";
5
+ export declare const convertElementTypePopupAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
6
+ type: "panel";
7
+ } | null> & {
8
+ init: {
9
+ type: "panel";
10
+ } | null;
11
+ };
12
+ declare const ConvertElementTypePopup: ({ app }: {
13
+ app: App;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene) => void;
16
+ type ConversionType = "generic" | "linear" | null;
17
+ export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
18
+ conversionType: ConversionType;
19
+ nextType?: ConvertibleTypes | undefined;
20
+ direction?: "left" | "right" | undefined;
21
+ }) => boolean;
22
+ export declare const getConversionTypeFromElements: (elements: ExcalidrawElement[]) => ConversionType;
23
+ export default ConvertElementTypePopup;
@@ -1,10 +1,11 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { Scene } from "@excalidraw/element";
2
3
  import "./ElementLinkDialog.scss";
3
4
  import type { AppProps, UIAppState } from "../types";
4
- declare const ElementLinkDialog: ({ sourceElementId, onClose, elementsMap, appState, generateLinkForSelection, }: {
5
+ declare const ElementLinkDialog: ({ sourceElementId, onClose, appState, scene, generateLinkForSelection, }: {
5
6
  sourceElementId: ExcalidrawElement["id"];
6
- elementsMap: ElementsMap;
7
7
  appState: UIAppState;
8
+ scene: Scene;
8
9
  onClose?: (() => void) | undefined;
9
10
  generateLinkForSelection: AppProps["generateLinkForSelection"];
10
11
  }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const Ellipsify: ({ children, ...rest }: {
3
+ children: React.ReactNode;
4
+ } & import("react").HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,7 @@ interface FontPickerProps {
16
16
  onHover: (fontFamily: FontFamilyValues) => void;
17
17
  onLeave: () => void;
18
18
  onPopupChange: (open: boolean) => void;
19
+ compactMode?: boolean;
19
20
  }
20
- export declare const FontPicker: React.MemoExoticComponent<({ isOpened, selectedFontFamily, hoveredFontFamily, onSelect, onHover, onLeave, onPopupChange, }: FontPickerProps) => import("react/jsx-runtime").JSX.Element>;
21
+ export declare const FontPicker: React.MemoExoticComponent<({ isOpened, selectedFontFamily, hoveredFontFamily, onSelect, onHover, onLeave, onPopupChange, compactMode, }: FontPickerProps) => import("react/jsx-runtime").JSX.Element>;
21
22
  export {};
@@ -1,6 +1,7 @@
1
1
  import type { FontFamilyValues } from "@excalidraw/element/types";
2
2
  interface FontPickerTriggerProps {
3
3
  selectedFontFamily: FontFamilyValues | null;
4
+ isOpened?: boolean;
4
5
  }
5
- export declare const FontPickerTrigger: ({ selectedFontFamily, }: FontPickerTriggerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const FontPickerTrigger: ({ selectedFontFamily, isOpened, }: FontPickerTriggerProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -10,6 +10,7 @@ interface PropertiesPopoverProps {
10
10
  onPointerLeave?: React.PointerEventHandler<HTMLDivElement>;
11
11
  onFocusOutside?: Popover.PopoverContentProps["onFocusOutside"];
12
12
  onPointerDownOutside?: Popover.PopoverContentProps["onPointerDownOutside"];
13
+ preventAutoFocusOnTouch?: boolean;
13
14
  }
14
15
  export declare const PropertiesPopover: React.ForwardRefExoticComponent<PropertiesPopoverProps & React.RefAttributes<HTMLDivElement>>;
15
16
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { JSX } from "react";
2
- export declare const ButtonIconSelect: <T extends Object>(props: {
2
+ export declare const RadioSelection: <T extends Object>(props: {
3
3
  options: {
4
4
  value: T;
5
5
  text: string;
@@ -1,8 +1,8 @@
1
1
  import "./Range.scss";
2
+ import type { AppClassProperties } from "../types";
2
3
  export type RangeProps = {
3
4
  updateData: (value: number) => void;
4
- appState: any;
5
- elements: any;
5
+ app: AppClassProperties;
6
6
  testId?: string;
7
7
  };
8
- export declare const Range: ({ updateData, appState, elements, testId, }: RangeProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const Range: ({ updateData, app, testId }: RangeProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface AngleProps {
5
5
  element: ExcalidrawElement;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface PositionProps {
5
5
  property: "gridStep";
@@ -5,6 +5,7 @@ interface CollapsibleProps {
5
5
  openTrigger: () => void;
6
6
  children: React.ReactNode;
7
7
  className?: string;
8
+ showCollapsedIcon?: boolean;
8
9
  }
9
- declare const Collapsible: ({ label, open, openTrigger, children, className, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const Collapsible: ({ label, open, openTrigger, children, className, showCollapsedIcon, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default Collapsible;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface DimensionDragInputProps {
5
5
  property: "width" | "height";
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { Scene } from "@excalidraw/element";
4
+ import { useApp, useExcalidrawSetAppState } from "../App";
3
5
  import "./DragInput.scss";
4
6
  import type { StatsInputProperty } from "./utils";
5
- import type Scene from "../../scene/Scene";
6
7
  import type { AppState } from "../../types";
7
8
  export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawElement> = (props: {
8
9
  accumulatedChange: number;
@@ -16,6 +17,14 @@ export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawEl
16
17
  property: P;
17
18
  originalAppState: AppState;
18
19
  setInputValue: (value: number) => void;
20
+ app: ReturnType<typeof useApp>;
21
+ setAppState: ReturnType<typeof useExcalidrawSetAppState>;
22
+ }) => void;
23
+ export type DragFinishedCallbackType<E = ExcalidrawElement> = (props: {
24
+ app: ReturnType<typeof useApp>;
25
+ setAppState: ReturnType<typeof useExcalidrawSetAppState>;
26
+ originalElements: readonly E[] | null;
27
+ originalAppState: AppState;
19
28
  }) => void;
20
29
  interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElement> {
21
30
  label: string | React.ReactNode;
@@ -30,6 +39,7 @@ interface StatsDragInputProps<T extends StatsInputProperty, E = ExcalidrawElemen
30
39
  appState: AppState;
31
40
  /** how many px you need to drag to get 1 unit change */
32
41
  sensitivity?: number;
42
+ dragFinishedCallback?: DragFinishedCallbackType;
33
43
  }
34
- declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
44
+ declare const StatsDragInput: <T extends StatsInputProperty, E extends ExcalidrawElement = ExcalidrawElement>({ label, icon, dragInputCallback, value, elements, editable, shouldKeepAspectRatio, property, scene, appState, sensitivity, dragFinishedCallback, }: StatsDragInputProps<T, E>) => import("react/jsx-runtime").JSX.Element | null;
35
45
  export default StatsDragInput;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface FontSizeProps {
5
5
  element: ExcalidrawElement;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiAngleProps {
5
5
  elements: readonly ExcalidrawElement[];
@@ -1,6 +1,6 @@
1
1
  import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
+ import type { Scene } from "@excalidraw/element";
2
3
  import type { AtomicUnit } from "./utils";
3
- import type Scene from "../../scene/Scene";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiDimensionProps {
6
6
  property: "width" | "height";
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiFontSizeProps {
5
5
  elements: readonly ExcalidrawElement[];
@@ -1,6 +1,6 @@
1
1
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { Scene } from "@excalidraw/element";
2
3
  import type { AtomicUnit } from "./utils";
3
- import type Scene from "../../scene/Scene";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiPositionProps {
6
6
  property: "x" | "y";
@@ -1,5 +1,5 @@
1
1
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  interface PositionProps {
5
5
  property: "x" | "y";
@@ -1,8 +1,9 @@
1
- import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
1
+ import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../../types";
4
4
  export type StatsInputProperty = "x" | "y" | "width" | "height" | "angle" | "fontSize" | "gridStep";
5
5
  export declare const SMALLEST_DELTA = 0.01;
6
+ export declare const STEP_SIZE = 10;
6
7
  export declare const isPropertyEditable: (element: ExcalidrawElement, property: keyof ExcalidrawElement) => boolean;
7
8
  export declare const getStepSizedValue: (value: number, stepSize: number) => number;
8
9
  export type AtomicUnit = Record<string, true>;
@@ -14,13 +15,5 @@ export declare const newOrigin: (x1: number, y1: number, w1: number, h1: number,
14
15
  x: number;
15
16
  y: number;
16
17
  };
17
- export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
+ export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
19
  export declare const getAtomicUnits: (targetElements: readonly ExcalidrawElement[], appState: AppState) => AtomicUnit[];
19
- export declare const updateBindings: (latestElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, options?: {
20
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
21
- newSize?: {
22
- width: number;
23
- height: number;
24
- };
25
- zoom?: AppState["zoom"];
26
- }) => void;
@@ -0,0 +1,8 @@
1
+ import "./UnlockPopup.scss";
2
+ import type App from "./App";
3
+ import type { AppState } from "../types";
4
+ declare const UnlockPopup: ({ app, activeLockedId, }: {
5
+ app: App;
6
+ activeLockedId: NonNullable<AppState["activeLockedId"]>;
7
+ }) => import("react/jsx-runtime").JSX.Element | null;
8
+ export default UnlockPopup;
@@ -14,6 +14,7 @@ type InteractiveCanvasProps = {
14
14
  selectionNonce: number | undefined;
15
15
  scale: number;
16
16
  appState: InteractiveCanvasAppState;
17
+ renderScrollbars: boolean;
17
18
  device: Device;
18
19
  renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
19
20
  handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
@@ -1,9 +1,10 @@
1
+ import type { Scene } from "@excalidraw/element";
1
2
  import type { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
3
  import "./Hyperlink.scss";
3
4
  import type { AppState, ExcalidrawProps, UIAppState } from "../../types";
4
- export declare const Hyperlink: ({ element, elementsMap, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
5
+ export declare const Hyperlink: ({ element, scene, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
5
6
  element: NonDeletedExcalidrawElement;
6
- elementsMap: ElementsMap;
7
+ scene: Scene;
7
8
  setAppState: React.Component<any, AppState>["setState"];
8
9
  onLinkOpen: ExcalidrawProps["onLinkOpen"];
9
10
  setToast: (toast: {
@@ -1,7 +1,8 @@
1
1
  import type { GlobalPoint, Radians } from "@excalidraw/math";
2
- import type { Bounds } from "@excalidraw/element/bounds";
2
+ import type { Bounds } from "@excalidraw/element";
3
3
  import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
4
  import type { AppState, UIAppState } from "../../types";
5
+ export declare const DEFAULT_LINK_SIZE = 12;
5
6
  export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
6
7
  export declare const ELEMENT_LINK_IMG: HTMLImageElement;
7
8
  export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<UIAppState, "zoom">) => Bounds;