@excalidraw/common 0.18.0-063e025 → 0.18.0-1118751

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 (154) hide show
  1. package/dist/dev/index.js +159 -17
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/colors.d.ts +22 -0
  5. package/dist/types/common/src/constants.d.ts +54 -0
  6. package/dist/types/common/src/keys.d.ts +4 -0
  7. package/dist/types/common/src/points.d.ts +1 -1
  8. package/dist/types/common/src/random.d.ts +7 -0
  9. package/dist/types/common/src/utils.d.ts +1 -1
  10. package/dist/types/element/src/Scene.d.ts +1 -1
  11. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  12. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  13. package/dist/types/element/src/binding.d.ts +15 -8
  14. package/dist/types/element/src/bucketFill.d.ts +110 -0
  15. package/dist/types/element/src/collision.d.ts +8 -5
  16. package/dist/types/element/src/comparisons.d.ts +7 -5
  17. package/dist/types/element/src/convertToShape.d.ts +23 -0
  18. package/dist/types/element/src/delta.d.ts +23 -1
  19. package/dist/types/element/src/dragElements.d.ts +27 -0
  20. package/dist/types/element/src/duplicate.d.ts +60 -0
  21. package/dist/types/element/src/flowchart.d.ts +10 -6
  22. package/dist/types/element/src/frame.d.ts +2 -2
  23. package/dist/types/element/src/groups.d.ts +1 -1
  24. package/dist/types/element/src/index.d.ts +4 -0
  25. package/dist/types/element/src/linearElementEditor.d.ts +17 -0
  26. package/dist/types/element/src/mutateElement.d.ts +1 -1
  27. package/dist/types/element/src/newElement.d.ts +37 -2
  28. package/dist/types/element/src/renderElement.d.ts +21 -4
  29. package/dist/types/element/src/selection.d.ts +1 -1
  30. package/dist/types/element/src/shape.d.ts +27 -1
  31. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  32. package/dist/types/element/src/sortElements.d.ts +10 -0
  33. package/dist/types/element/src/stickyNote.d.ts +183 -0
  34. package/dist/types/element/src/textElement.d.ts +7 -3
  35. package/dist/types/element/src/transform.d.ts +25 -6
  36. package/dist/types/element/src/typeChecks.d.ts +3 -2
  37. package/dist/types/element/src/types.d.ts +35 -6
  38. package/dist/types/element/src/utils.d.ts +15 -4
  39. package/dist/types/element/src/zindex.d.ts +1 -1
  40. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -9
  41. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  42. package/dist/types/excalidraw/actions/actionBoundText.d.ts +32 -6
  43. package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -580
  44. package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -6
  45. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -3
  46. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +50 -10
  47. package/dist/types/excalidraw/actions/actionDeselect.d.ts +13 -3
  48. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  49. package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -3
  50. package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -6
  51. package/dist/types/excalidraw/actions/actionExport.d.ts +38 -12
  52. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  53. package/dist/types/excalidraw/actions/actionFrame.d.ts +99 -185
  54. package/dist/types/excalidraw/actions/actionGroup.d.ts +33 -7
  55. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +68 -4
  56. package/dist/types/excalidraw/actions/actionLink.d.ts +16 -3
  57. package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -3
  58. package/dist/types/excalidraw/actions/actionProperties.d.ts +45 -12
  59. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +16 -3
  60. package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -4
  61. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  62. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -3
  63. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -3
  64. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -3
  65. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -3
  66. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -3
  67. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -3
  68. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +17 -4
  69. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -3
  70. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  71. package/dist/types/excalidraw/actions/index.d.ts +1 -2
  72. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  73. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  74. package/dist/types/excalidraw/actions/types.d.ts +5 -1
  75. package/dist/types/excalidraw/appState.d.ts +30 -9
  76. package/dist/types/excalidraw/components/Actions.d.ts +16 -10
  77. package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
  78. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  79. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  80. package/dist/types/excalidraw/components/App.d.ts +468 -99
  81. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  82. package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
  83. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  84. package/dist/types/excalidraw/components/App.pan.d.ts +54 -0
  85. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  86. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  87. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  88. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +8 -2
  89. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  90. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
  91. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  92. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  93. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  94. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  95. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  96. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  97. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  98. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  99. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  100. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  101. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  102. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  103. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  104. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  105. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  106. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  107. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  108. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  109. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  110. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  111. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  112. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  113. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  114. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  115. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  116. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  117. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
  118. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  119. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  120. package/dist/types/excalidraw/components/icons.d.ts +5 -1
  121. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -1
  122. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  123. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  124. package/dist/types/excalidraw/data/blob.d.ts +44 -18
  125. package/dist/types/excalidraw/data/json.d.ts +22 -9
  126. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  127. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  128. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  129. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  130. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  131. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  132. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  133. package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
  134. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  135. package/dist/types/excalidraw/scene/types.d.ts +6 -1
  136. package/dist/types/excalidraw/types.d.ts +341 -21
  137. package/dist/types/excalidraw/viewport.d.ts +31 -66
  138. package/dist/types/laser-pointer/src/state.d.ts +1 -0
  139. package/dist/types/math/src/curve.d.ts +19 -12
  140. package/dist/types/math/src/index.d.ts +1 -0
  141. package/dist/types/math/src/pca.d.ts +79 -0
  142. package/dist/types/math/src/polygon.d.ts +25 -1
  143. package/dist/types/math/src/segment.d.ts +6 -0
  144. package/dist/types/utils/src/export.d.ts +1 -0
  145. package/dist/types/utils/src/shape.d.ts +2 -2
  146. package/package.json +1 -1
  147. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
  148. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  149. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  150. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  151. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  152. package/dist/types/excalidraw/components/shapes.d.ts +0 -270
  153. package/dist/types/excalidraw/cursor.d.ts +0 -5
  154. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
@@ -20,7 +20,13 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
20
20
  data: {
21
21
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
22
22
  appState: {
23
+ zoom: import("../types").Zoom;
23
24
  viewModeEnabled: boolean;
25
+ activeTool: {
26
+ lastActiveTool: import("../types").ActiveTool | null;
27
+ locked: boolean;
28
+ fromSelection: boolean;
29
+ } & import("../types").ActiveTool;
24
30
  zenModeEnabled: boolean;
25
31
  gridModeEnabled: boolean;
26
32
  objectsSnapModeEnabled: boolean;
@@ -28,11 +34,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
28
34
  name: string | null;
29
35
  currentItemArrowType: "sharp" | "round" | "elbow";
30
36
  gridSize: number;
31
- activeTool: {
32
- lastActiveTool: import("../types").ActiveTool | null;
33
- locked: boolean;
34
- fromSelection: boolean;
35
- } & import("../types").ActiveTool;
36
37
  contextMenu: {
37
38
  items: import("../components/ContextMenu").ContextMenuItems;
38
39
  top: number;
@@ -53,10 +54,15 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
53
54
  boxSelectionMode: import("../types").BoxSelectionMode;
54
55
  bindingPreference: "enabled" | "disabled";
55
56
  isMidpointSnappingEnabled: boolean;
57
+ inputDevice: import("../types").InputDevice;
56
58
  suggestedBinding: {
57
59
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
58
60
  midPoint?: import("@excalidraw/math").GlobalPoint;
59
61
  } | null;
62
+ hoveredArrowTextAnchor: {
63
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
64
+ anchor: "start" | "end" | "label";
65
+ } | null;
60
66
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
61
67
  frameRendering: {
62
68
  enabled: boolean;
@@ -64,7 +70,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
64
70
  outline: boolean;
65
71
  clip: boolean;
66
72
  };
67
- editingFrame: string | null;
73
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
68
74
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
69
75
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
70
76
  preferredSelectionTool: {
@@ -78,6 +84,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
78
84
  exportWithDarkMode: boolean;
79
85
  exportScale: number;
80
86
  currentItemStrokeColor: string;
87
+ currentItemStickynoteStrokeColor: string;
88
+ currentItemStickynoteBackgroundColor: string;
81
89
  currentItemBackgroundColor: string;
82
90
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
83
91
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -100,7 +108,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
100
108
  scrolledOutside: boolean;
101
109
  isResizing: boolean;
102
110
  isRotating: boolean;
103
- zoom: import("../types").Zoom;
104
111
  openMenu: "canvas" | null;
105
112
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
106
113
  openSidebar: {
@@ -160,8 +167,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
160
167
  x: number;
161
168
  y: number;
162
169
  } | null;
163
- userToFollow: import("../types").UserToFollow | null;
164
- followedBy: Set<import("../types").SocketId>;
165
170
  isCropping: boolean;
166
171
  croppingElementId: ExcalidrawElement["id"] | null;
167
172
  searchMatches: Readonly<{
@@ -173,6 +178,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
173
178
  [groupId: string]: true;
174
179
  };
175
180
  bindMode: import("@excalidraw/element/types").BindMode;
181
+ colorTopPicks: {
182
+ elementStroke: readonly string[] | null;
183
+ elementBackground: readonly string[] | null;
184
+ bucketFill: readonly string[] | null;
185
+ stickyNoteStroke: readonly string[] | null;
186
+ stickyNoteBackground: readonly string[] | null;
187
+ };
188
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
176
189
  };
177
190
  files: import("../types").BinaryFiles;
178
191
  };
@@ -187,7 +200,13 @@ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | nu
187
200
  fileHandle?: FileSystemFileHandle | null) => Promise<{
188
201
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
189
202
  appState: {
203
+ zoom: import("../types").Zoom;
190
204
  viewModeEnabled: boolean;
205
+ activeTool: {
206
+ lastActiveTool: import("../types").ActiveTool | null;
207
+ locked: boolean;
208
+ fromSelection: boolean;
209
+ } & import("../types").ActiveTool;
191
210
  zenModeEnabled: boolean;
192
211
  gridModeEnabled: boolean;
193
212
  objectsSnapModeEnabled: boolean;
@@ -195,11 +214,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
195
214
  name: string | null;
196
215
  currentItemArrowType: "sharp" | "round" | "elbow";
197
216
  gridSize: number;
198
- activeTool: {
199
- lastActiveTool: import("../types").ActiveTool | null;
200
- locked: boolean;
201
- fromSelection: boolean;
202
- } & import("../types").ActiveTool;
203
217
  contextMenu: {
204
218
  items: import("../components/ContextMenu").ContextMenuItems;
205
219
  top: number;
@@ -220,10 +234,15 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
220
234
  boxSelectionMode: import("../types").BoxSelectionMode;
221
235
  bindingPreference: "enabled" | "disabled";
222
236
  isMidpointSnappingEnabled: boolean;
237
+ inputDevice: import("../types").InputDevice;
223
238
  suggestedBinding: {
224
239
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
225
240
  midPoint?: import("@excalidraw/math").GlobalPoint;
226
241
  } | null;
242
+ hoveredArrowTextAnchor: {
243
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
244
+ anchor: "start" | "end" | "label";
245
+ } | null;
227
246
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
228
247
  frameRendering: {
229
248
  enabled: boolean;
@@ -231,7 +250,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
231
250
  outline: boolean;
232
251
  clip: boolean;
233
252
  };
234
- editingFrame: string | null;
253
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
235
254
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
236
255
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
237
256
  preferredSelectionTool: {
@@ -245,6 +264,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
245
264
  exportWithDarkMode: boolean;
246
265
  exportScale: number;
247
266
  currentItemStrokeColor: string;
267
+ currentItemStickynoteStrokeColor: string;
268
+ currentItemStickynoteBackgroundColor: string;
248
269
  currentItemBackgroundColor: string;
249
270
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
250
271
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -267,7 +288,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
267
288
  scrolledOutside: boolean;
268
289
  isResizing: boolean;
269
290
  isRotating: boolean;
270
- zoom: import("../types").Zoom;
271
291
  openMenu: "canvas" | null;
272
292
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
273
293
  openSidebar: {
@@ -327,8 +347,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
327
347
  x: number;
328
348
  y: number;
329
349
  } | null;
330
- userToFollow: import("../types").UserToFollow | null;
331
- followedBy: Set<import("../types").SocketId>;
332
350
  isCropping: boolean;
333
351
  croppingElementId: ExcalidrawElement["id"] | null;
334
352
  searchMatches: Readonly<{
@@ -340,6 +358,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
340
358
  [groupId: string]: true;
341
359
  };
342
360
  bindMode: import("@excalidraw/element/types").BindMode;
361
+ colorTopPicks: {
362
+ elementStroke: readonly string[] | null;
363
+ elementBackground: readonly string[] | null;
364
+ bucketFill: readonly string[] | null;
365
+ stickyNoteStroke: readonly string[] | null;
366
+ stickyNoteBackground: readonly string[] | null;
367
+ };
368
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
343
369
  };
344
370
  files: import("../types").BinaryFiles;
345
371
  }>;
@@ -18,7 +18,13 @@ export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
18
18
  export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
19
19
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
20
20
  appState: {
21
+ zoom: import("../types").Zoom;
21
22
  viewModeEnabled: boolean;
23
+ activeTool: {
24
+ lastActiveTool: import("../types").ActiveTool | null;
25
+ locked: boolean;
26
+ fromSelection: boolean;
27
+ } & import("../types").ActiveTool;
22
28
  zenModeEnabled: boolean;
23
29
  gridModeEnabled: boolean;
24
30
  objectsSnapModeEnabled: boolean;
@@ -26,11 +32,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
26
32
  name: string | null;
27
33
  currentItemArrowType: "sharp" | "round" | "elbow";
28
34
  gridSize: number;
29
- activeTool: {
30
- lastActiveTool: import("../types").ActiveTool | null;
31
- locked: boolean;
32
- fromSelection: boolean;
33
- } & import("../types").ActiveTool;
34
35
  contextMenu: {
35
36
  items: import("../components/ContextMenu").ContextMenuItems;
36
37
  top: number;
@@ -51,10 +52,15 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
51
52
  boxSelectionMode: import("../types").BoxSelectionMode;
52
53
  bindingPreference: "enabled" | "disabled";
53
54
  isMidpointSnappingEnabled: boolean;
55
+ inputDevice: import("../types").InputDevice;
54
56
  suggestedBinding: {
55
57
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
56
58
  midPoint?: import("@excalidraw/math").GlobalPoint;
57
59
  } | null;
60
+ hoveredArrowTextAnchor: {
61
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
62
+ anchor: "start" | "end" | "label";
63
+ } | null;
58
64
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
59
65
  frameRendering: {
60
66
  enabled: boolean;
@@ -62,7 +68,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
62
68
  outline: boolean;
63
69
  clip: boolean;
64
70
  };
65
- editingFrame: string | null;
71
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
66
72
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
67
73
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
68
74
  preferredSelectionTool: {
@@ -76,6 +82,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
76
82
  exportWithDarkMode: boolean;
77
83
  exportScale: number;
78
84
  currentItemStrokeColor: string;
85
+ currentItemStickynoteStrokeColor: string;
86
+ currentItemStickynoteBackgroundColor: string;
79
87
  currentItemBackgroundColor: string;
80
88
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
81
89
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -98,7 +106,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
98
106
  scrolledOutside: boolean;
99
107
  isResizing: boolean;
100
108
  isRotating: boolean;
101
- zoom: import("../types").Zoom;
102
109
  openMenu: "canvas" | null;
103
110
  openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
104
111
  openSidebar: {
@@ -158,8 +165,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
158
165
  x: number;
159
166
  y: number;
160
167
  } | null;
161
- userToFollow: import("../types").UserToFollow | null;
162
- followedBy: Set<import("../types").SocketId>;
163
168
  isCropping: boolean;
164
169
  croppingElementId: ExcalidrawElement["id"] | null;
165
170
  searchMatches: Readonly<{
@@ -171,6 +176,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
171
176
  [groupId: string]: true;
172
177
  };
173
178
  bindMode: import("@excalidraw/element/types").BindMode;
179
+ colorTopPicks: {
180
+ elementStroke: readonly string[] | null;
181
+ elementBackground: readonly string[] | null;
182
+ bucketFill: readonly string[] | null;
183
+ stickyNoteStroke: readonly string[] | null;
184
+ stickyNoteBackground: readonly string[] | null;
185
+ };
186
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
174
187
  };
175
188
  files: BinaryFiles;
176
189
  }>;
@@ -0,0 +1,16 @@
1
+ import type { GlobalPoint } from "@excalidraw/math";
2
+ import type App from "./components/App";
3
+ import type { Trail } from "./animatedTrail";
4
+ export declare class DrawShapeTrail implements Trail {
5
+ private app;
6
+ private trail;
7
+ constructor(app: App);
8
+ private getTrailOptions;
9
+ startPath(x: number, y: number): void;
10
+ addPointToPath(x: number, y: number): void;
11
+ endPath(): void;
12
+ clearTrails(): void;
13
+ getCurrentPoints(): GlobalPoint[];
14
+ start(container: SVGSVGElement): void;
15
+ stop(): void;
16
+ }
@@ -15,7 +15,8 @@ export declare class Fonts {
15
15
  fontFaces: ExcalidrawFontFace[];
16
16
  }>;
17
17
  private readonly scene;
18
- constructor(scene: Scene);
18
+ private readonly ownerDocument;
19
+ constructor(scene: Scene, ownerDocument?: Document);
19
20
  /**
20
21
  * Get all the font families for the given scene.
21
22
  */
@@ -36,7 +37,7 @@ export declare class Fonts {
36
37
  /**
37
38
  * Load font faces for passed elements - use when the scene is unavailable (i.e. export).
38
39
  */
39
- static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
40
+ static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
40
41
  /**
41
42
  * Generate CSS @font-face declarations for the given elements.
42
43
  */
@@ -2,13 +2,13 @@ export type CaretPosition = {
2
2
  start: number;
3
3
  end: number;
4
4
  };
5
- export declare const saveCaretPosition: () => CaretPosition | null;
6
- export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
7
- export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
8
- export declare const useTextEditorFocus: () => {
5
+ export declare const saveCaretPosition: (ownerDocument?: Document) => CaretPosition | null;
6
+ export declare const restoreCaretPosition: (position: CaretPosition | null, ownerDocument?: Document) => void;
7
+ export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void, ownerDocument?: Document) => void;
8
+ export declare const useTextEditorFocus: (ownerDocument?: Document) => {
9
9
  saveCaretPosition: () => void;
10
10
  restoreCaretPosition: () => void;
11
11
  clearSavedPosition: () => void;
12
12
  hasSavedPosition: boolean;
13
13
  };
14
- export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
14
+ export declare const temporarilyDisableTextEditorBlur: (ownerDocument?: Document, duration?: number) => void;
@@ -1,5 +1,6 @@
1
1
  import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
2
2
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { BoxSelectionMode } from "../types";
3
4
  export declare const getLassoSelectedElementIds: (input: {
4
5
  lassoPath: GlobalPoint[];
5
6
  elements: readonly ExcalidrawElement[];
@@ -8,6 +9,7 @@ export declare const getLassoSelectedElementIds: (input: {
8
9
  intersectedElements: Set<ExcalidrawElement["id"]>;
9
10
  enclosedElements: Set<ExcalidrawElement["id"]>;
10
11
  simplifyDistance?: number;
12
+ mode?: BoxSelectionMode;
11
13
  }) => {
12
14
  selectedElementIds: string[];
13
15
  };
@@ -0,0 +1,9 @@
1
+ import type { ElementRenderOffsets, ElementRenderOverrides } from "./types";
2
+ /** Validate and copy before publishing, so a rejected snapshot changes nothing. */
3
+ export declare const copyElementRenderOverrides: (overrides: ElementRenderOverrides | null) => ElementRenderOverrides;
4
+ /**
5
+ * Extracts the offsets of a snapshot, returning `previous` when they are the
6
+ * same. Visibility is memoized on this map's identity, so a snapshot that only
7
+ * changes opacities (a fade) never re-runs viewport geometry.
8
+ */
9
+ export declare const getElementRenderOffsets: (overrides: ElementRenderOverrides, previous: ElementRenderOffsets) => ElementRenderOffsets;
@@ -1,6 +1,31 @@
1
1
  import type { StaticCanvasRenderConfig } from "../scene/types";
2
2
  import type { AppState, StaticCanvasAppState } from "../types";
3
+ export declare const DEFAULT_SELECTION_COLOR = "#6965db";
4
+ /**
5
+ * Returns the theme's selection color (`--color-selection`), read from the
6
+ * computed style of any element inside the editor container so that host
7
+ * overrides are respected. Falls back to the default when unavailable.
8
+ */
9
+ export declare const getSelectionColor: (element: Element | null | undefined) => string;
3
10
  export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
11
+ /**
12
+ * The scroll the renderers draw at: the real one, rounded to whole device
13
+ * pixels. Panning writes a fractional scroll (pointer delta ÷ zoom), and an
14
+ * element's cached bitmap blitted at a fractional device offset gets
15
+ * resampled — so as the fraction drifts under a pan, every element pulses
16
+ * between crisp and soft. A whole-pixel scroll moves the scene the way a
17
+ * browser scrolls a page: each element keeps its own, constant sub-pixel
18
+ * phase and a pan never changes how anything is filtered. The difference
19
+ * stays under half a device pixel, so hit-testing and DOM overlays keep
20
+ * using the real scroll. Identity when nothing needs to change.
21
+ */
22
+ export declare const snapScrollToDevicePixels: <T extends {
23
+ scrollX: number;
24
+ scrollY: number;
25
+ zoom: {
26
+ value: number;
27
+ };
28
+ }>(appState: T, scale: number) => T;
4
29
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
30
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
6
31
  canvas: HTMLCanvasElement;
@@ -1,6 +1,6 @@
1
1
  import { getScrollBars } from "../scene/scrollbars";
2
2
  import type { InteractiveSceneRenderConfig } from "../scene/types";
3
- declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
3
+ declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState: unsnappedAppState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
4
4
  scrollBars?: ReturnType<typeof getScrollBars>;
5
5
  animationState?: typeof animationState;
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { RenderableElementsMap } from "./types";
4
- import type { AppState } from "../types";
4
+ import type { AppState, ElementRenderOffsets } from "../types";
5
5
  type GetRenderableElementsOpts = {
6
6
  zoom: AppState["zoom"];
7
7
  offsetLeft: AppState["offsetLeft"];
@@ -19,6 +19,19 @@ type GetRenderableElementsOpts = {
19
19
  export declare class Renderer {
20
20
  private scene;
21
21
  constructor(scene: Scene);
22
+ /**
23
+ * Adjusts the document-visible set for render-override translations: an
24
+ * element leaves it when its offset moves it out of view and enters it when
25
+ * its offset brings it in; everything else keeps its document visibility.
26
+ * Only translated elements go through viewport geometry. The result is
27
+ * memoized on the offsets' identity so that opacity-only snapshots don't
28
+ * reach it at all.
29
+ */
30
+ getVisibleElementsWithRenderOffsets(visibleElements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, appState: AppState, offsets: ElementRenderOffsets): readonly NonDeletedExcalidrawElement[];
31
+ private _getVisibleElementsWithRenderOffsets;
32
+ /** the document-visible elements as a set, cached per visible array */
33
+ private visibleSets;
34
+ private getVisibleSet;
22
35
  private getVisibleCanvasElements;
23
36
  private getRenderableElementsMap;
24
37
  private sortSelectedElementsIntoHighlightedFrame;
@@ -53,6 +66,7 @@ export declare class Renderer {
53
66
  frameId: string | null;
54
67
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
55
68
  updated: number;
69
+ created: number | null;
56
70
  link: string | null;
57
71
  locked: boolean;
58
72
  customData?: Record<string, any>;
@@ -92,6 +106,7 @@ export declare class Renderer {
92
106
  frameId: string | null;
93
107
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
94
108
  updated: number;
109
+ created: number | null;
95
110
  link: string | null;
96
111
  locked: boolean;
97
112
  customData?: Record<string, any>;
@@ -126,6 +141,43 @@ export declare class Renderer {
126
141
  frameId: string | null;
127
142
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
128
143
  updated: number;
144
+ created: number | null;
145
+ link: string | null;
146
+ locked: boolean;
147
+ customData?: Record<string, any>;
148
+ }> & Readonly<{
149
+ type: "stickynote";
150
+ baseHeight: number;
151
+ }> & {
152
+ isDeleted: false;
153
+ }) | (Readonly<{
154
+ id: string;
155
+ x: number;
156
+ y: number;
157
+ strokeColor: string;
158
+ backgroundColor: string;
159
+ fillStyle: import("@excalidraw/element/types").FillStyle;
160
+ strokeWidth: number;
161
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
162
+ roundness: null | {
163
+ type: import("@excalidraw/element/types").RoundnessType;
164
+ value?: number;
165
+ };
166
+ roughness: number;
167
+ opacity: number;
168
+ width: number;
169
+ height: number;
170
+ angle: import("@excalidraw/math").Radians;
171
+ seed: number;
172
+ version: number;
173
+ versionNonce: number;
174
+ index: import("@excalidraw/element/types").FractionalIndex | null;
175
+ isDeleted: boolean;
176
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
177
+ frameId: string | null;
178
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
179
+ updated: number;
180
+ created: number | null;
129
181
  link: string | null;
130
182
  locked: boolean;
131
183
  customData?: Record<string, any>;
@@ -160,6 +212,7 @@ export declare class Renderer {
160
212
  frameId: string | null;
161
213
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
162
214
  updated: number;
215
+ created: number | null;
163
216
  link: string | null;
164
217
  locked: boolean;
165
218
  customData?: Record<string, any>;
@@ -194,6 +247,7 @@ export declare class Renderer {
194
247
  frameId: string | null;
195
248
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
196
249
  updated: number;
250
+ created: number | null;
197
251
  link: string | null;
198
252
  locked: boolean;
199
253
  customData?: Record<string, any>;
@@ -228,6 +282,7 @@ export declare class Renderer {
228
282
  frameId: string | null;
229
283
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
230
284
  updated: number;
285
+ created: number | null;
231
286
  link: string | null;
232
287
  locked: boolean;
233
288
  customData?: Record<string, any>;
@@ -265,6 +320,7 @@ export declare class Renderer {
265
320
  frameId: string | null;
266
321
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
267
322
  updated: number;
323
+ created: number | null;
268
324
  link: string | null;
269
325
  locked: boolean;
270
326
  customData?: Record<string, any>;
@@ -303,6 +359,7 @@ export declare class Renderer {
303
359
  frameId: string | null;
304
360
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
305
361
  updated: number;
362
+ created: number | null;
306
363
  link: string | null;
307
364
  locked: boolean;
308
365
  customData?: Record<string, any>;
@@ -338,6 +395,7 @@ export declare class Renderer {
338
395
  frameId: string | null;
339
396
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
340
397
  updated: number;
398
+ created: number | null;
341
399
  link: string | null;
342
400
  locked: boolean;
343
401
  customData?: Record<string, any>;
@@ -373,6 +431,7 @@ export declare class Renderer {
373
431
  frameId: string | null;
374
432
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
375
433
  updated: number;
434
+ created: number | null;
376
435
  link: string | null;
377
436
  locked: boolean;
378
437
  customData?: Record<string, any>;
@@ -380,15 +439,17 @@ export declare class Renderer {
380
439
  type: "text";
381
440
  fontSize: number;
382
441
  fontFamily: import("@excalidraw/element/types").FontFamilyValues;
442
+ baseFontSize: number | null;
383
443
  text: string;
384
444
  textAlign: import("@excalidraw/element/types").TextAlign;
385
445
  verticalAlign: import("@excalidraw/element/types").VerticalAlign;
386
- containerId: import("@excalidraw/element/types").ExcalidrawGenericElement["id"] | null;
446
+ containerId: import("@excalidraw/element/types").ExcalidrawTextContainer["id"] | null;
387
447
  originalText: string;
388
448
  autoResize: boolean;
389
449
  lineHeight: number & {
390
450
  _brand: "unitlessLineHeight";
391
451
  };
452
+ labelPosition?: number | null;
392
453
  }> & {
393
454
  isDeleted: false;
394
455
  }) | (Readonly<{
@@ -418,6 +479,7 @@ export declare class Renderer {
418
479
  frameId: string | null;
419
480
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
420
481
  updated: number;
482
+ created: number | null;
421
483
  link: string | null;
422
484
  locked: boolean;
423
485
  customData?: Record<string, any>;
@@ -1,4 +1,4 @@
1
1
  export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
2
2
  export { getScrollToContentState } from "../viewport";
3
- export { hasBackground, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
3
+ export { hasBackground, hasFillStyle, hasRoughness, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
4
4
  export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
@@ -1,7 +1,7 @@
1
1
  import type { UserIdleState, EditorInterface } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
3
  import type { MakeBrand } from "@excalidraw/common/utility-types";
4
- import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
4
+ import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementRenderOverrides, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
5
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
6
6
  import type { Drawable } from "roughjs/bin/core";
7
7
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
@@ -9,6 +9,9 @@ export type StaticCanvasRenderConfig = {
9
9
  canvasBackgroundColor: AppState["viewBackgroundColor"];
10
10
  imageCache: AppClassProperties["imageCache"];
11
11
  renderGrid: boolean;
12
+ /** whether to render link icons on elements with links (never rendered
13
+ when exporting). @default true */
14
+ renderLinks?: boolean;
12
15
  /** when exporting the behavior is slightly different (e.g. we can't use
13
16
  CSS filters), and we disable render optimizations for best output */
14
17
  isExporting: boolean;
@@ -16,6 +19,7 @@ export type StaticCanvasRenderConfig = {
16
19
  elementsPendingErasure: ElementsPendingErasure;
17
20
  pendingFlowchartNodes: PendingExcalidrawElements | null;
18
21
  theme: AppState["theme"];
22
+ elementRenderOverrides?: ElementRenderOverrides;
19
23
  };
20
24
  export type SVGRenderConfig = {
21
25
  offsetX: number;
@@ -129,6 +133,7 @@ export type ElementShapes = {
129
133
  arrow: Drawable[];
130
134
  line: Drawable[];
131
135
  text: null;
136
+ stickynote: null;
132
137
  image: null;
133
138
  frame: null;
134
139
  magicframe: null;