@excalidraw/element 0.18.0-9ba0f5d → 0.18.0-a9ca16e

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 (128) hide show
  1. package/dist/dev/index.js +3757 -2654
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +13 -12
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/appEventBus.d.ts +27 -0
  6. package/dist/types/common/src/colors.d.ts +1 -1
  7. package/dist/types/common/src/constants.d.ts +4 -0
  8. package/dist/types/common/src/index.d.ts +3 -0
  9. package/dist/types/common/src/utils.d.ts +4 -7
  10. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  11. package/dist/types/element/src/Scene.d.ts +2 -0
  12. package/dist/types/element/src/arrowheads.d.ts +3 -0
  13. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  14. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  15. package/dist/types/element/src/binding.d.ts +13 -8
  16. package/dist/types/element/src/bounds.d.ts +1 -1
  17. package/dist/types/element/src/collision.d.ts +4 -3
  18. package/dist/types/element/src/distribute.d.ts +2 -1
  19. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  20. package/dist/types/element/src/index.d.ts +3 -0
  21. package/dist/types/element/src/linearElementEditor.d.ts +5 -0
  22. package/dist/types/element/src/mutateElement.d.ts +2 -0
  23. package/dist/types/element/src/selection.d.ts +5 -1
  24. package/dist/types/element/src/textElement.d.ts +1 -1
  25. package/dist/types/element/src/textWrapping.d.ts +26 -0
  26. package/dist/types/element/src/types.d.ts +5 -2
  27. package/dist/types/element/src/utils.d.ts +5 -3
  28. package/dist/types/element/src/zindex.d.ts +1 -1
  29. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +38 -35
  30. package/dist/types/excalidraw/actions/actionBoundText.d.ts +27 -25
  31. package/dist/types/excalidraw/actions/actionCanvas.d.ts +157 -145
  32. package/dist/types/excalidraw/actions/actionClipboard.d.ts +26 -24
  33. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +13 -12
  34. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +41 -36
  35. package/dist/types/excalidraw/actions/actionElementLink.d.ts +9 -12
  36. package/dist/types/excalidraw/actions/actionElementLock.d.ts +26 -24
  37. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +13 -12
  38. package/dist/types/excalidraw/actions/actionExport.d.ts +75 -347
  39. package/dist/types/excalidraw/actions/actionFrame.d.ts +52 -48
  40. package/dist/types/excalidraw/actions/actionGroup.d.ts +27 -25
  41. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +15 -12
  42. package/dist/types/excalidraw/actions/actionLink.d.ts +13 -12
  43. package/dist/types/excalidraw/actions/actionMenu.d.ts +9 -12
  44. package/dist/types/excalidraw/actions/actionProperties.d.ts +28 -26
  45. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +13 -12
  46. package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -11
  47. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  48. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
  49. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +13 -12
  50. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
  51. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -12
  52. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +9 -12
  53. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -12
  54. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +13 -12
  55. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -12
  56. package/dist/types/excalidraw/actions/index.d.ts +2 -0
  57. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  58. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  59. package/dist/types/excalidraw/appState.d.ts +9 -7
  60. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  61. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  62. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  63. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  64. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  65. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  66. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  67. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  68. package/dist/types/excalidraw/clipboard.d.ts +6 -7
  69. package/dist/types/excalidraw/components/App.d.ts +53 -13
  70. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  71. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
  72. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  73. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  74. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  75. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  76. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
  77. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
  78. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  79. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
  80. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  81. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
  82. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  83. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
  84. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  85. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +4 -0
  86. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  87. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  88. package/dist/types/excalidraw/components/Toast.d.ts +8 -4
  89. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
  90. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
  91. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
  92. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
  93. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  94. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
  95. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  96. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  97. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  98. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  99. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  100. package/dist/types/excalidraw/components/icons.d.ts +23 -9
  101. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +17 -0
  102. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
  103. package/dist/types/excalidraw/components/shapes.d.ts +74 -1
  104. package/dist/types/excalidraw/data/blob.d.ts +45 -44
  105. package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
  106. package/dist/types/excalidraw/data/index.d.ts +2 -3
  107. package/dist/types/excalidraw/data/json.d.ts +37 -28
  108. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  109. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  110. package/dist/types/excalidraw/types.d.ts +93 -16
  111. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
  112. package/dist/types/math/src/point.d.ts +7 -2
  113. package/dist/types/math/src/types.d.ts +25 -1
  114. package/package.json +3 -3
  115. package/dist/types/excalidraw/charts.d.ts +0 -27
  116. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  117. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
  118. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  119. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
  120. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
  121. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  122. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
  123. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  124. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  125. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
  126. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  127. package/dist/types/excalidraw/index.d.ts +0 -46
  128. package/dist/types/excalidraw/polyfill.d.ts +0 -2
@@ -2,12 +2,11 @@ import { IMAGE_MIME_TYPES, MIME_TYPES } from "@excalidraw/common";
2
2
  import type { ValueOf } from "@excalidraw/common/utility-types";
3
3
  import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
4
4
  import type { AppState, DataURL, LibraryItem } from "../types";
5
- import type { FileSystemHandle } from "browser-fs-access";
6
5
  import type { ImportedLibraryData } from "./types";
7
6
  export declare const getMimeType: (blob: Blob | string) => string;
8
- export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
7
+ export declare const getFileHandleType: (handle: FileSystemFileHandle | null) => string | null;
9
8
  export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
10
- export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
9
+ export declare const isImageFileHandle: (handle: FileSystemFileHandle | null) => handle is FileSystemFileHandle;
11
10
  export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
12
11
  export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
13
12
  type: ValueOf<typeof IMAGE_MIME_TYPES>;
@@ -15,8 +14,8 @@ export declare const isSupportedImageFile: (blob: Blob | null | undefined) => bl
15
14
  export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File,
16
15
  /** @see restore.localAppState */
17
16
  localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
18
- /** FileSystemHandle. Defaults to `blob.handle` if defined, otherwise null. */
19
- fileHandle?: FileSystemHandle | null) => Promise<{
17
+ /** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
18
+ fileHandle?: FileSystemFileHandle | null) => Promise<{
20
19
  type: "application/vnd.excalidraw+json";
21
20
  data: {
22
21
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
@@ -46,12 +45,21 @@ fileHandle?: FileSystemHandle | null) => Promise<{
46
45
  } | {
47
46
  name: "elementLinkSelector";
48
47
  sourceElementId: ExcalidrawElement["id"];
48
+ } | {
49
+ name: "charts";
50
+ data: import("../charts").Spreadsheet;
51
+ rawText: string;
49
52
  };
50
53
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
51
54
  selectedElementIds: Readonly<{
52
55
  [id: string]: true;
53
56
  }>;
54
57
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
58
+ activeTool: {
59
+ lastActiveTool: import("../types").ActiveTool | null;
60
+ locked: boolean;
61
+ fromSelection: boolean;
62
+ } & import("../types").ActiveTool;
55
63
  activeEmbeddable: {
56
64
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
57
65
  state: "hover" | "active";
@@ -64,13 +72,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
64
72
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
65
73
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
66
74
  isBindingEnabled: boolean;
67
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
75
+ isMidpointSnappingEnabled: boolean;
76
+ suggestedBinding: {
77
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
78
+ midPoint?: import("@excalidraw/math").GlobalPoint;
79
+ } | null;
68
80
  isRotating: boolean;
69
81
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
70
82
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
71
83
  snapLines: readonly import("../snapping").SnapLine[];
72
84
  zenModeEnabled: boolean;
73
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
85
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
74
86
  isCropping: boolean;
75
87
  croppingElementId: ExcalidrawElement["id"] | null;
76
88
  searchMatches: Readonly<{
@@ -83,6 +95,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
83
95
  }>;
84
96
  shouldCacheIgnoreZoom: boolean;
85
97
  exportScale: number;
98
+ currentItemArrowType: "sharp" | "round" | "elbow";
86
99
  bindMode: import("@excalidraw/element/types").BindMode;
87
100
  gridSize: number;
88
101
  contextMenu: {
@@ -94,13 +107,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
94
107
  isLoading: boolean;
95
108
  errorMessage: React.ReactNode;
96
109
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
110
+ bindingPreference: "enabled" | "disabled";
97
111
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
98
112
  editingFrame: string | null;
99
- activeTool: {
100
- lastActiveTool: import("../types").ActiveTool | null;
101
- locked: boolean;
102
- fromSelection: boolean;
103
- } & import("../types").ActiveTool;
104
113
  preferredSelectionTool: {
105
114
  type: "selection" | "lasso";
106
115
  initialized: boolean;
@@ -124,7 +133,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
124
133
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
125
134
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
126
135
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
127
- currentItemArrowType: "sharp" | "round" | "elbow";
128
136
  cursorButton: "up" | "down";
129
137
  scrolledOutside: boolean;
130
138
  isResizing: boolean;
@@ -141,25 +149,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
141
149
  };
142
150
  selectedElementsAreBeingDragged: boolean;
143
151
  toast: {
144
- message: string;
152
+ message: React.ReactNode;
145
153
  closable?: boolean;
146
154
  duration?: number;
147
155
  } | null;
148
156
  gridStep: number;
149
157
  gridModeEnabled: boolean;
150
- fileHandle: FileSystemHandle | null;
158
+ fileHandle: FileSystemFileHandle | null;
151
159
  stats: {
152
160
  open: boolean;
153
161
  panels: number;
154
162
  };
155
- currentChartType: import("@excalidraw/element/types").ChartType;
156
- pasteDialog: {
157
- shown: false;
158
- data: null;
159
- } | {
160
- shown: true;
161
- data: import("../charts").Spreadsheet;
162
- };
163
163
  showHyperlinkPopup: false | "info" | "editor";
164
164
  originSnapOffset: {
165
165
  x: number;
@@ -181,8 +181,8 @@ fileHandle?: FileSystemHandle | null) => Promise<{
181
181
  export declare const loadFromBlob: (blob: Blob,
182
182
  /** @see restore.localAppState */
183
183
  localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
184
- /** FileSystemHandle. Defaults to `blob.handle` if defined, otherwise null. */
185
- fileHandle?: FileSystemHandle | null) => Promise<{
184
+ /** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
185
+ fileHandle?: FileSystemFileHandle | null) => Promise<{
186
186
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
187
187
  appState: {
188
188
  viewBackgroundColor: string;
@@ -210,12 +210,21 @@ fileHandle?: FileSystemHandle | null) => Promise<{
210
210
  } | {
211
211
  name: "elementLinkSelector";
212
212
  sourceElementId: ExcalidrawElement["id"];
213
+ } | {
214
+ name: "charts";
215
+ data: import("../charts").Spreadsheet;
216
+ rawText: string;
213
217
  };
214
218
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
215
219
  selectedElementIds: Readonly<{
216
220
  [id: string]: true;
217
221
  }>;
218
222
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
223
+ activeTool: {
224
+ lastActiveTool: import("../types").ActiveTool | null;
225
+ locked: boolean;
226
+ fromSelection: boolean;
227
+ } & import("../types").ActiveTool;
219
228
  activeEmbeddable: {
220
229
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
221
230
  state: "hover" | "active";
@@ -228,13 +237,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
228
237
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
229
238
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
230
239
  isBindingEnabled: boolean;
231
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
240
+ isMidpointSnappingEnabled: boolean;
241
+ suggestedBinding: {
242
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
243
+ midPoint?: import("@excalidraw/math").GlobalPoint;
244
+ } | null;
232
245
  isRotating: boolean;
233
246
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
234
247
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
235
248
  snapLines: readonly import("../snapping").SnapLine[];
236
249
  zenModeEnabled: boolean;
237
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
250
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
238
251
  isCropping: boolean;
239
252
  croppingElementId: ExcalidrawElement["id"] | null;
240
253
  searchMatches: Readonly<{
@@ -247,6 +260,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
247
260
  }>;
248
261
  shouldCacheIgnoreZoom: boolean;
249
262
  exportScale: number;
263
+ currentItemArrowType: "sharp" | "round" | "elbow";
250
264
  bindMode: import("@excalidraw/element/types").BindMode;
251
265
  gridSize: number;
252
266
  contextMenu: {
@@ -258,13 +272,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
258
272
  isLoading: boolean;
259
273
  errorMessage: React.ReactNode;
260
274
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
275
+ bindingPreference: "enabled" | "disabled";
261
276
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
262
277
  editingFrame: string | null;
263
- activeTool: {
264
- lastActiveTool: import("../types").ActiveTool | null;
265
- locked: boolean;
266
- fromSelection: boolean;
267
- } & import("../types").ActiveTool;
268
278
  preferredSelectionTool: {
269
279
  type: "selection" | "lasso";
270
280
  initialized: boolean;
@@ -288,7 +298,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
288
298
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
289
299
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
290
300
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
291
- currentItemArrowType: "sharp" | "round" | "elbow";
292
301
  cursorButton: "up" | "down";
293
302
  scrolledOutside: boolean;
294
303
  isResizing: boolean;
@@ -305,25 +314,17 @@ fileHandle?: FileSystemHandle | null) => Promise<{
305
314
  };
306
315
  selectedElementsAreBeingDragged: boolean;
307
316
  toast: {
308
- message: string;
317
+ message: React.ReactNode;
309
318
  closable?: boolean;
310
319
  duration?: number;
311
320
  } | null;
312
321
  gridStep: number;
313
322
  gridModeEnabled: boolean;
314
- fileHandle: FileSystemHandle | null;
323
+ fileHandle: FileSystemFileHandle | null;
315
324
  stats: {
316
325
  open: boolean;
317
326
  panels: number;
318
327
  };
319
- currentChartType: import("@excalidraw/element/types").ChartType;
320
- pasteDialog: {
321
- shown: false;
322
- data: null;
323
- } | {
324
- shown: true;
325
- data: import("../charts").Spreadsheet;
326
- };
327
328
  showHyperlinkPopup: false | "info" | "editor";
328
329
  originSnapOffset: {
329
330
  x: number;
@@ -358,7 +359,7 @@ export declare const SVGStringToFile: (SVGString: string, filename?: string) =>
358
359
  type: typeof MIME_TYPES.svg;
359
360
  };
360
361
  export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
361
- export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<FileSystemHandle | null>;
362
+ export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTransferItem) => Promise<FileSystemFileHandle | null>;
362
363
  export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: string, name: string | undefined) => File;
363
364
  /** attempts to detect correct mimeType if none is set, or if an image
364
365
  * has an incorrect extension.
@@ -1,6 +1,5 @@
1
1
  import { supported as nativeFileSystemSupported } from "browser-fs-access";
2
2
  import { MIME_TYPES } from "@excalidraw/common";
3
- import type { FileSystemHandle } from "browser-fs-access";
4
3
  type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
5
4
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
6
5
  extensions?: FILE_EXTENSION[];
@@ -14,8 +13,7 @@ export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
14
13
  extension: FILE_EXTENSION;
15
14
  mimeTypes?: string[];
16
15
  description: string;
17
- /** existing FileSystemHandle */
18
- fileHandle?: FileSystemHandle | null;
19
- }) => Promise<FileSystemHandle | null>;
16
+ /** existing FileSystemFileHandle */
17
+ fileHandle?: FileSystemFileHandle | null;
18
+ }) => Promise<FileSystemFileHandle | null>;
20
19
  export { nativeFileSystemSupported };
21
- export type { FileSystemHandle };
@@ -1,5 +1,4 @@
1
1
  import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- import type { FileSystemHandle } from "./filesystem";
3
2
  import type { ExportType } from "../scene/types";
4
3
  import type { AppState, BinaryFiles } from "../types";
5
4
  export { loadFromBlob } from "./blob";
@@ -17,6 +16,6 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
17
16
  viewBackgroundColor: string;
18
17
  /** filename, if applicable */
19
18
  name?: string;
20
- fileHandle?: FileSystemHandle | null;
19
+ fileHandle?: FileSystemFileHandle | null;
21
20
  exportingFrame: ExcalidrawFrameLikeElement | null;
22
- }) => Promise<FileSystemHandle | null | undefined>;
21
+ }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -1,11 +1,19 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
2
+ import type { MaybePromise } from "@excalidraw/common/utility-types";
2
3
  import type { AppState, BinaryFiles, LibraryItems } from "../types";
3
4
  import type { ImportedDataState, ImportedLibraryData } from "./types";
5
+ export type JSONExportData = {
6
+ elements: readonly NonDeleted<ExcalidrawElement>[];
7
+ appState: AppState;
8
+ files: BinaryFiles;
9
+ };
4
10
  export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
5
- export declare const saveAsJSON: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles,
6
- /** filename */
7
- name?: string) => Promise<{
8
- fileHandle: import("browser-fs-access").FileSystemHandle | null;
11
+ export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
12
+ data: MaybePromise<JSONExportData>;
13
+ filename: string;
14
+ fileHandle: AppState["fileHandle"];
15
+ }) => Promise<{
16
+ fileHandle: FileSystemFileHandle | null;
9
17
  }>;
10
18
  export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
11
19
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
@@ -35,12 +43,21 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
35
43
  } | {
36
44
  name: "elementLinkSelector";
37
45
  sourceElementId: ExcalidrawElement["id"];
46
+ } | {
47
+ name: "charts";
48
+ data: import("../charts").Spreadsheet;
49
+ rawText: string;
38
50
  };
39
51
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
40
52
  selectedElementIds: Readonly<{
41
53
  [id: string]: true;
42
54
  }>;
43
- frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
55
+ frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
56
+ activeTool: {
57
+ lastActiveTool: import("../types").ActiveTool | null;
58
+ locked: boolean;
59
+ fromSelection: boolean;
60
+ } & import("../types").ActiveTool;
44
61
  activeEmbeddable: {
45
62
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
46
63
  state: "hover" | "active";
@@ -50,16 +67,20 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
50
67
  [groupId: string]: boolean;
51
68
  };
52
69
  selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
53
- multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
54
- newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
70
+ multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
+ newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
55
72
  isBindingEnabled: boolean;
56
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
73
+ isMidpointSnappingEnabled: boolean;
74
+ suggestedBinding: {
75
+ element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
76
+ midPoint?: import("@excalidraw/math").GlobalPoint;
77
+ } | null;
57
78
  isRotating: boolean;
58
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
79
+ elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
59
80
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
60
81
  snapLines: readonly import("../snapping").SnapLine[];
61
82
  zenModeEnabled: boolean;
62
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
83
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
63
84
  isCropping: boolean;
64
85
  croppingElementId: ExcalidrawElement["id"] | null;
65
86
  searchMatches: Readonly<{
@@ -72,6 +93,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
72
93
  }>;
73
94
  shouldCacheIgnoreZoom: boolean;
74
95
  exportScale: number;
96
+ currentItemArrowType: "sharp" | "round" | "elbow";
75
97
  bindMode: import("@excalidraw/element/types").BindMode;
76
98
  gridSize: number;
77
99
  contextMenu: {
@@ -83,13 +105,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
83
105
  isLoading: boolean;
84
106
  errorMessage: React.ReactNode;
85
107
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
86
- startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
108
+ bindingPreference: "enabled" | "disabled";
109
+ startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
87
110
  editingFrame: string | null;
88
- activeTool: {
89
- lastActiveTool: import("../types").ActiveTool | null;
90
- locked: boolean;
91
- fromSelection: boolean;
92
- } & import("../types").ActiveTool;
93
111
  preferredSelectionTool: {
94
112
  type: "selection" | "lasso";
95
113
  initialized: boolean;
@@ -113,7 +131,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
113
131
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
114
132
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
115
133
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
116
- currentItemArrowType: "sharp" | "round" | "elbow";
117
134
  cursorButton: "up" | "down";
118
135
  scrolledOutside: boolean;
119
136
  isResizing: boolean;
@@ -130,25 +147,17 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
130
147
  };
131
148
  selectedElementsAreBeingDragged: boolean;
132
149
  toast: {
133
- message: string;
150
+ message: React.ReactNode;
134
151
  closable?: boolean;
135
152
  duration?: number;
136
153
  } | null;
137
154
  gridStep: number;
138
155
  gridModeEnabled: boolean;
139
- fileHandle: import("browser-fs-access").FileSystemHandle | null;
156
+ fileHandle: FileSystemFileHandle | null;
140
157
  stats: {
141
158
  open: boolean;
142
159
  panels: number;
143
160
  };
144
- currentChartType: import("@excalidraw/element/types").ChartType;
145
- pasteDialog: {
146
- shown: false;
147
- data: null;
148
- } | {
149
- shown: true;
150
- data: import("../charts").Spreadsheet;
151
- };
152
161
  showHyperlinkPopup: false | "info" | "editor";
153
162
  originSnapOffset: {
154
163
  x: number;
@@ -1,5 +1,10 @@
1
+ import type { MaybePromise } from "@excalidraw/common/utility-types";
1
2
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
3
  import type { AppState, BinaryFiles } from "../types";
3
- export declare const resaveAsImageWithScene: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles, name: string) => Promise<{
4
- fileHandle: import("browser-fs-access").FileSystemHandle;
4
+ export declare const resaveAsImageWithScene: (data: MaybePromise<{
5
+ elements: readonly ExcalidrawElement[];
6
+ appState: AppState;
7
+ files: BinaryFiles;
8
+ }>, fileHandle: FileSystemFileHandle, filename: string) => Promise<{
9
+ fileHandle: FileSystemFileHandle;
5
10
  }>;
@@ -0,0 +1,15 @@
1
+ import { type GlobalPoint } from "@excalidraw/math";
2
+ import type { EditorInterface } from "@excalidraw/common";
3
+ import type { ExcalidrawTextElement } from "@excalidraw/element/types";
4
+ export declare const getTextBoxPadding: (zoomValue: number) => number;
5
+ export declare const getTextAutoResizeHandle: (textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => {
6
+ center: GlobalPoint | import("@excalidraw/math").LocalPoint;
7
+ start: GlobalPoint;
8
+ end: GlobalPoint;
9
+ hitboxWidth: number;
10
+ hitboxHeight: number;
11
+ } | null;
12
+ export declare const isPointHittingTextAutoResizeHandle: (point: Readonly<{
13
+ x: number;
14
+ y: number;
15
+ }>, textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => boolean;