@excalidraw/math 0.18.0-2b0e4c9 → 0.18.0-2b1c2a9

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 (192) hide show
  1. package/dist/dev/index.js +311 -114
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/src/colors.d.ts +20 -1
  5. package/dist/types/common/src/constants.d.ts +12 -7
  6. package/dist/types/common/src/keys.d.ts +2 -0
  7. package/dist/types/common/src/points.d.ts +1 -1
  8. package/dist/types/common/src/utils.d.ts +1 -43
  9. package/dist/types/element/src/Scene.d.ts +6 -4
  10. package/dist/types/element/src/align.d.ts +2 -2
  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 +17 -8
  14. package/dist/types/element/src/bounds.d.ts +22 -7
  15. package/dist/types/element/src/bucketFill.d.ts +110 -0
  16. package/dist/types/element/src/collision.d.ts +1 -1
  17. package/dist/types/element/src/comparisons.d.ts +5 -4
  18. package/dist/types/element/src/convertToShape.d.ts +23 -0
  19. package/dist/types/element/src/distribute.d.ts +2 -2
  20. package/dist/types/element/src/dragElements.d.ts +27 -0
  21. package/dist/types/element/src/duplicate.d.ts +4 -3
  22. package/dist/types/element/src/embeddable.d.ts +2 -2
  23. package/dist/types/element/src/flowchart.d.ts +7 -7
  24. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  25. package/dist/types/element/src/frame.d.ts +9 -8
  26. package/dist/types/element/src/groups.d.ts +9 -9
  27. package/dist/types/element/src/index.d.ts +4 -1
  28. package/dist/types/element/src/linearElementEditor.d.ts +27 -10
  29. package/dist/types/element/src/newElement.d.ts +15 -0
  30. package/dist/types/element/src/renderElement.d.ts +0 -3
  31. package/dist/types/element/src/resizeElements.d.ts +2 -2
  32. package/dist/types/element/src/selection.d.ts +11 -7
  33. package/dist/types/element/src/shape.d.ts +13 -1
  34. package/dist/types/element/src/sortElements.d.ts +10 -0
  35. package/dist/types/element/src/textElement.d.ts +14 -10
  36. package/dist/types/element/src/textWrapping.d.ts +26 -0
  37. package/dist/types/element/src/transform.d.ts +2 -2
  38. package/dist/types/element/src/typeChecks.d.ts +26 -25
  39. package/dist/types/element/src/types.d.ts +15 -1
  40. package/dist/types/element/src/utils.d.ts +7 -3
  41. package/dist/types/element/src/zindex.d.ts +2 -2
  42. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -21
  43. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  44. package/dist/types/excalidraw/actions/actionBoundText.d.ts +33 -15
  45. package/dist/types/excalidraw/actions/actionCanvas.d.ts +174 -947
  46. package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -14
  47. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -7
  48. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +50 -22
  49. package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionDeselect.d.ts} +30 -36
  50. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  51. package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -7
  52. package/dist/types/excalidraw/actions/actionElementLock.d.ts +33 -15
  53. package/dist/types/excalidraw/actions/actionExport.d.ts +34 -16
  54. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  55. package/dist/types/excalidraw/actions/actionFrame.d.ts +61 -205
  56. package/dist/types/excalidraw/actions/actionGroup.d.ts +48 -30
  57. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +21 -9
  58. package/dist/types/excalidraw/actions/actionLink.d.ts +17 -8
  59. package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -7
  60. package/dist/types/excalidraw/actions/actionProperties.d.ts +62 -32
  61. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +21 -12
  62. package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -7
  63. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  64. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +17 -8
  65. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +20 -12
  66. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +17 -8
  67. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +17 -8
  68. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +20 -12
  69. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  70. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +17 -8
  71. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +18 -9
  72. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +17 -8
  73. package/dist/types/excalidraw/actions/index.d.ts +2 -2
  74. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  75. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  76. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  77. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  78. package/dist/types/excalidraw/appState.d.ts +12 -5
  79. package/dist/types/excalidraw/components/Actions.d.ts +17 -12
  80. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  81. package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
  82. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  83. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  84. package/dist/types/excalidraw/components/App.d.ts +391 -68
  85. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  86. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  87. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  88. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  89. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  90. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -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/colorPickerUtils.d.ts +1 -1
  95. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  96. package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
  97. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  98. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
  99. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  100. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  101. package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
  102. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  103. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  104. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  105. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  106. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  107. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  108. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  109. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  110. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  111. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  112. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  113. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  114. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  115. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  116. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  117. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  118. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  119. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  120. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  121. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  122. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  123. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  124. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  125. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  126. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  127. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  128. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  129. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  130. package/dist/types/excalidraw/components/Tools.d.ts +146 -0
  131. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  132. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  133. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -1
  134. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
  135. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  136. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  137. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  138. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
  139. package/dist/types/excalidraw/components/icons.d.ts +6 -1
  140. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +8 -4
  141. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  142. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  143. package/dist/types/excalidraw/data/blob.d.ts +36 -18
  144. package/dist/types/excalidraw/data/index.d.ts +4 -4
  145. package/dist/types/excalidraw/data/json.d.ts +24 -15
  146. package/dist/types/excalidraw/data/library.d.ts +1 -1
  147. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  148. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  149. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  150. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  151. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  152. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  153. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  154. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  155. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  156. package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
  157. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -0
  158. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
  159. package/dist/types/excalidraw/scene/Renderer.d.ts +427 -19
  160. package/dist/types/excalidraw/scene/export.d.ts +3 -3
  161. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  162. package/dist/types/excalidraw/scene/types.d.ts +4 -3
  163. package/dist/types/excalidraw/snapping.d.ts +7 -7
  164. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  165. package/dist/types/excalidraw/types.d.ts +436 -24
  166. package/dist/types/excalidraw/viewport.d.ts +275 -0
  167. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +6 -3
  168. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  169. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  170. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  171. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  172. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  173. package/dist/types/math/src/constants.d.ts +0 -1
  174. package/dist/types/math/src/curve.d.ts +23 -13
  175. package/dist/types/math/src/index.d.ts +1 -0
  176. package/dist/types/math/src/pca.d.ts +79 -0
  177. package/dist/types/math/src/point.d.ts +2 -1
  178. package/dist/types/math/src/polygon.d.ts +25 -1
  179. package/dist/types/math/src/segment.d.ts +6 -0
  180. package/dist/types/utils/src/export.d.ts +3 -3
  181. package/dist/types/utils/src/index.d.ts +1 -2
  182. package/package.json +2 -2
  183. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  184. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  185. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  186. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  187. package/dist/types/excalidraw/components/shapes.d.ts +0 -263
  188. package/dist/types/excalidraw/cursor.d.ts +0 -5
  189. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  190. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  191. package/dist/types/utils/src/bbox.d.ts +0 -9
  192. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -73,16 +73,21 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
73
73
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
74
74
  isBindingEnabled: boolean;
75
75
  isMidpointSnappingEnabled: boolean;
76
+ gridModeEnabled: boolean;
76
77
  suggestedBinding: {
77
78
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
78
79
  midPoint?: import("@excalidraw/math").GlobalPoint;
79
80
  } | null;
81
+ hoveredArrowTextAnchor: {
82
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
83
+ anchor: "start" | "end" | "label";
84
+ } | null;
80
85
  isRotating: boolean;
81
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
86
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
82
87
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
83
88
  snapLines: readonly import("../snapping").SnapLine[];
84
89
  zenModeEnabled: boolean;
85
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
90
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
86
91
  isCropping: boolean;
87
92
  croppingElementId: ExcalidrawElement["id"] | null;
88
93
  searchMatches: Readonly<{
@@ -96,8 +101,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
96
101
  shouldCacheIgnoreZoom: boolean;
97
102
  exportScale: number;
98
103
  currentItemArrowType: "sharp" | "round" | "elbow";
99
- bindMode: import("@excalidraw/element/types").BindMode;
100
104
  gridSize: number;
105
+ bindMode: import("@excalidraw/element/types").BindMode;
101
106
  contextMenu: {
102
107
  items: import("../components/ContextMenu").ContextMenuItems;
103
108
  top: number;
@@ -107,9 +112,9 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
107
112
  isLoading: boolean;
108
113
  errorMessage: React.ReactNode;
109
114
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
115
+ boxSelectionMode: import("../types").BoxSelectionMode;
110
116
  bindingPreference: "enabled" | "disabled";
111
- startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
112
- editingFrame: string | null;
117
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
113
118
  preferredSelectionTool: {
114
119
  type: "selection" | "lasso";
115
120
  initialized: boolean;
@@ -122,9 +127,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
122
127
  currentItemStrokeColor: string;
123
128
  currentItemBackgroundColor: string;
124
129
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
125
- currentItemStrokeWidth: number;
130
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
126
131
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
127
132
  currentItemRoughness: number;
133
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
128
134
  currentItemOpacity: number;
129
135
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
130
136
  currentItemFontSize: number;
@@ -133,6 +139,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
133
139
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
134
140
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
135
141
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
142
+ scrollConstraints: import("../types").ScrollConstraints | null;
136
143
  cursorButton: "up" | "down";
137
144
  scrolledOutside: boolean;
138
145
  isResizing: boolean;
@@ -154,7 +161,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
154
161
  duration?: number;
155
162
  } | null;
156
163
  gridStep: number;
157
- gridModeEnabled: boolean;
158
164
  fileHandle: FileSystemFileHandle | null;
159
165
  stats: {
160
166
  open: boolean;
@@ -166,11 +172,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
166
172
  y: number;
167
173
  } | null;
168
174
  objectsSnapModeEnabled: boolean;
169
- userToFollow: import("../types").UserToFollow | null;
170
- followedBy: Set<import("../types").SocketId>;
171
175
  lockedMultiSelections: {
172
176
  [groupId: string]: true;
173
177
  };
178
+ colorTopPicks: {
179
+ elementStroke: readonly string[] | null;
180
+ elementBackground: readonly string[] | null;
181
+ bucketFill: readonly string[] | null;
182
+ };
174
183
  };
175
184
  files: import("../types").BinaryFiles;
176
185
  };
@@ -238,16 +247,21 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
238
247
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
239
248
  isBindingEnabled: boolean;
240
249
  isMidpointSnappingEnabled: boolean;
250
+ gridModeEnabled: boolean;
241
251
  suggestedBinding: {
242
252
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
243
253
  midPoint?: import("@excalidraw/math").GlobalPoint;
244
254
  } | null;
255
+ hoveredArrowTextAnchor: {
256
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
257
+ anchor: "start" | "end" | "label";
258
+ } | null;
245
259
  isRotating: boolean;
246
- elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
260
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
247
261
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
248
262
  snapLines: readonly import("../snapping").SnapLine[];
249
263
  zenModeEnabled: boolean;
250
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
264
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
251
265
  isCropping: boolean;
252
266
  croppingElementId: ExcalidrawElement["id"] | null;
253
267
  searchMatches: Readonly<{
@@ -261,8 +275,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
261
275
  shouldCacheIgnoreZoom: boolean;
262
276
  exportScale: number;
263
277
  currentItemArrowType: "sharp" | "round" | "elbow";
264
- bindMode: import("@excalidraw/element/types").BindMode;
265
278
  gridSize: number;
279
+ bindMode: import("@excalidraw/element/types").BindMode;
266
280
  contextMenu: {
267
281
  items: import("../components/ContextMenu").ContextMenuItems;
268
282
  top: number;
@@ -272,9 +286,9 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
272
286
  isLoading: boolean;
273
287
  errorMessage: React.ReactNode;
274
288
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
289
+ boxSelectionMode: import("../types").BoxSelectionMode;
275
290
  bindingPreference: "enabled" | "disabled";
276
- startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
277
- editingFrame: string | null;
291
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
278
292
  preferredSelectionTool: {
279
293
  type: "selection" | "lasso";
280
294
  initialized: boolean;
@@ -287,9 +301,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
287
301
  currentItemStrokeColor: string;
288
302
  currentItemBackgroundColor: string;
289
303
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
290
- currentItemStrokeWidth: number;
304
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
291
305
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
292
306
  currentItemRoughness: number;
307
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
293
308
  currentItemOpacity: number;
294
309
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
295
310
  currentItemFontSize: number;
@@ -298,6 +313,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
298
313
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
299
314
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
300
315
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
316
+ scrollConstraints: import("../types").ScrollConstraints | null;
301
317
  cursorButton: "up" | "down";
302
318
  scrolledOutside: boolean;
303
319
  isResizing: boolean;
@@ -319,7 +335,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
319
335
  duration?: number;
320
336
  } | null;
321
337
  gridStep: number;
322
- gridModeEnabled: boolean;
323
338
  fileHandle: FileSystemFileHandle | null;
324
339
  stats: {
325
340
  open: boolean;
@@ -331,11 +346,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
331
346
  y: number;
332
347
  } | null;
333
348
  objectsSnapModeEnabled: boolean;
334
- userToFollow: import("../types").UserToFollow | null;
335
- followedBy: Set<import("../types").SocketId>;
336
349
  lockedMultiSelections: {
337
350
  [groupId: string]: true;
338
351
  };
352
+ colorTopPicks: {
353
+ elementStroke: readonly string[] | null;
354
+ elementBackground: readonly string[] | null;
355
+ bucketFill: readonly string[] | null;
356
+ };
339
357
  };
340
358
  files: import("../types").BinaryFiles;
341
359
  }>;
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { ExportType } from "../scene/types";
3
3
  import type { AppState, BinaryFiles } from "../types";
4
4
  export { loadFromBlob } from "./blob";
@@ -6,8 +6,8 @@ export { loadFromJSON, saveAsJSON } from "./json";
6
6
  export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
7
7
  _brand: "exportedElements";
8
8
  };
9
- export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
10
- exportingFrame: ExcalidrawFrameLikeElement | null;
9
+ export declare const prepareElementsForExport: (allElements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
10
+ exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
11
11
  exportedElements: ExportedElements;
12
12
  };
13
13
  export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
@@ -17,5 +17,5 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
17
17
  /** filename, if applicable */
18
18
  name?: string;
19
19
  fileHandle?: FileSystemFileHandle | null;
20
- exportingFrame: ExcalidrawFrameLikeElement | null;
20
+ exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
21
21
  }) => Promise<FileSystemFileHandle | null | undefined>;
@@ -1,9 +1,9 @@
1
- import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { MaybePromise } from "@excalidraw/common/utility-types";
3
3
  import type { AppState, BinaryFiles, LibraryItems } from "../types";
4
4
  import type { ImportedDataState, ImportedLibraryData } from "./types";
5
5
  export type JSONExportData = {
6
- elements: readonly NonDeleted<ExcalidrawElement>[];
6
+ elements: readonly ExcalidrawElement[];
7
7
  appState: AppState;
8
8
  files: BinaryFiles;
9
9
  };
@@ -52,7 +52,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
52
52
  selectedElementIds: Readonly<{
53
53
  [id: string]: true;
54
54
  }>;
55
- frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
55
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
56
56
  activeTool: {
57
57
  lastActiveTool: import("../types").ActiveTool | null;
58
58
  locked: boolean;
@@ -67,20 +67,25 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
67
67
  [groupId: string]: boolean;
68
68
  };
69
69
  selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
70
- multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
- newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
70
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
71
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
72
72
  isBindingEnabled: boolean;
73
73
  isMidpointSnappingEnabled: boolean;
74
+ gridModeEnabled: boolean;
74
75
  suggestedBinding: {
75
- element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
76
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
76
77
  midPoint?: import("@excalidraw/math").GlobalPoint;
77
78
  } | null;
79
+ hoveredArrowTextAnchor: {
80
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
81
+ anchor: "start" | "end" | "label";
82
+ } | null;
78
83
  isRotating: boolean;
79
- elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
84
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
80
85
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
81
86
  snapLines: readonly import("../snapping").SnapLine[];
82
87
  zenModeEnabled: boolean;
83
- editingTextElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
88
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
84
89
  isCropping: boolean;
85
90
  croppingElementId: ExcalidrawElement["id"] | null;
86
91
  searchMatches: Readonly<{
@@ -94,8 +99,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
94
99
  shouldCacheIgnoreZoom: boolean;
95
100
  exportScale: number;
96
101
  currentItemArrowType: "sharp" | "round" | "elbow";
97
- bindMode: import("@excalidraw/element/types").BindMode;
98
102
  gridSize: number;
103
+ bindMode: import("@excalidraw/element/types").BindMode;
99
104
  contextMenu: {
100
105
  items: import("../components/ContextMenu").ContextMenuItems;
101
106
  top: number;
@@ -105,9 +110,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
105
110
  isLoading: boolean;
106
111
  errorMessage: React.ReactNode;
107
112
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
113
+ boxSelectionMode: import("../types").BoxSelectionMode;
108
114
  bindingPreference: "enabled" | "disabled";
109
- startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
110
- editingFrame: string | null;
115
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
111
116
  preferredSelectionTool: {
112
117
  type: "selection" | "lasso";
113
118
  initialized: boolean;
@@ -120,9 +125,10 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
120
125
  currentItemStrokeColor: string;
121
126
  currentItemBackgroundColor: string;
122
127
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
123
- currentItemStrokeWidth: number;
128
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
124
129
  currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
125
130
  currentItemRoughness: number;
131
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
126
132
  currentItemOpacity: number;
127
133
  currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
128
134
  currentItemFontSize: number;
@@ -131,6 +137,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
131
137
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
132
138
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
133
139
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
140
+ scrollConstraints: import("../types").ScrollConstraints | null;
134
141
  cursorButton: "up" | "down";
135
142
  scrolledOutside: boolean;
136
143
  isResizing: boolean;
@@ -152,7 +159,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
152
159
  duration?: number;
153
160
  } | null;
154
161
  gridStep: number;
155
- gridModeEnabled: boolean;
156
162
  fileHandle: FileSystemFileHandle | null;
157
163
  stats: {
158
164
  open: boolean;
@@ -164,11 +170,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
164
170
  y: number;
165
171
  } | null;
166
172
  objectsSnapModeEnabled: boolean;
167
- userToFollow: import("../types").UserToFollow | null;
168
- followedBy: Set<import("../types").SocketId>;
169
173
  lockedMultiSelections: {
170
174
  [groupId: string]: true;
171
175
  };
176
+ colorTopPicks: {
177
+ elementStroke: readonly string[] | null;
178
+ elementBackground: readonly string[] | null;
179
+ bucketFill: readonly string[] | null;
180
+ };
172
181
  };
173
182
  files: BinaryFiles;
174
183
  }>;
@@ -37,7 +37,7 @@ export interface LibraryMigrationAdapter {
37
37
  /** clears entire storage afterwards */
38
38
  clear(): MaybePromise<void>;
39
39
  }
40
- export declare const libraryItemsAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
40
+ export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
41
41
  status: "loading" | "loaded";
42
42
  /** indicates whether library is initialized with library items (has gone
43
43
  * through at least one update). Used in UI. Specific to this atom only. */
@@ -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
+ }
@@ -1,10 +1,9 @@
1
- import { AnimatedTrail } from "../animated-trail";
2
- import type { AnimationFrameHandler } from "../animation-frame-handler";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class EraserTrail extends AnimatedTrail {
5
4
  private elementsToErase;
6
5
  private groupsToErase;
7
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
6
+ constructor(app: App);
8
7
  startPath(x: number, y: number): void;
9
8
  addPointToPath(x: number, y: number, restore?: boolean): string[];
10
9
  private updateElementsToBeErased;
@@ -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
  */
@@ -0,0 +1,29 @@
1
+ import type { AppState } from "../types";
2
+ /**
3
+ * Subscribes to specific appState changes. The component re-renders
4
+ * only when the specified prop(s) change — not on every appState update.
5
+ *
6
+ * Works both inside and outside the <Excalidraw> tree, as long as
7
+ * ExcalidrawAPIContext.Provider is an ancestor (automatically provided
8
+ * inside <Excalidraw>, or manually by the host app).
9
+ *
10
+ * Returns the narrowed value depending on prop form:
11
+ * - `keyof AppState` → `AppState[K]`
12
+ * - `(keyof AppState)[]` → whole `AppState`
13
+ * - selector function → selector's return type `T`
14
+ *
15
+ * If excalidrawAPI is not ready yet (host apps), hook is rerendered with latest
16
+ * value once available.
17
+ */
18
+ export declare function useAppStateValue<K extends keyof AppState>(prop: K, _internal?: boolean): AppState[K];
19
+ export declare function useAppStateValue(props: (keyof AppState)[], _internal?: boolean): AppState;
20
+ export declare function useAppStateValue<T>(selector: (appState: AppState) => T, _internal?: boolean): T;
21
+ /**
22
+ * Subscribes to specific appState changes without causing component rerenders.
23
+ *
24
+ * The callback is called on every matching change, but also on initial render
25
+ * so you can initialize your state.
26
+ */
27
+ export declare function useOnAppStateChange<K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void): undefined;
28
+ export declare function useOnAppStateChange(props: (keyof AppState)[], callback: (props: AppState, appState: AppState) => void): undefined;
29
+ export declare function useOnAppStateChange<T>(selector: (appState: AppState) => T, callback: (value: T, appState: AppState) => void): undefined;
@@ -1,6 +1,6 @@
1
1
  import type { LibraryItem } from "../types";
2
2
  export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
3
- export declare const libraryItemSvgsCache: import("jotai/vanilla/atom").PrimitiveAtom<SvgCache> & {
3
+ export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
4
4
  init: SvgCache;
5
5
  };
6
6
  export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache, ref: React.RefObject<HTMLDivElement | null>) => SVGSVGElement | undefined;
@@ -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,20 +1,18 @@
1
- import { AnimatedTrail } from "./animated-trail";
2
- import type { Trail } from "./animated-trail";
3
- import type { AnimationFrameHandler } from "./animation-frame-handler";
1
+ import { AnimatedTrail } from "./animatedTrail";
2
+ import type { Trail } from "./animatedTrail";
4
3
  import type App from "./components/App";
5
4
  export declare class LaserTrails implements Trail {
6
- private animationFrameHandler;
7
5
  private app;
8
6
  localTrail: AnimatedTrail;
9
7
  private collabTrails;
10
8
  private container?;
11
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
9
+ constructor(app: App);
12
10
  private getTrailOptions;
13
11
  startPath(x: number, y: number): void;
14
12
  addPointToPath(x: number, y: number): void;
15
13
  endPath(): void;
16
14
  start(container: SVGSVGElement): void;
17
15
  stop(): void;
18
- onFrame(): void;
19
- private updateCollabTrails;
16
+ private stopCollabTrails;
17
+ updateCollabTrails(collaborators: App["state"]["collaborators"]): void;
20
18
  }
@@ -1,5 +1,4 @@
1
- import { type AnimationFrameHandler } from "../animation-frame-handler";
2
- import { AnimatedTrail } from "../animated-trail";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class LassoTrail extends AnimatedTrail {
5
4
  private intersectedElements;
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
7
6
  private elementsSegments;
8
7
  private canvasTranslate;
9
8
  private keepPreviousSelection;
10
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
9
+ constructor(app: App);
11
10
  startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
12
11
  selectElementsFromIds: (ids: string[]) => void;
13
12
  addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => 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
  };
@@ -3,10 +3,14 @@ export type Animation<R extends object> = (params: {
3
3
  state?: R;
4
4
  }) => R | null | undefined;
5
5
  export declare class AnimationController {
6
- private static isRunning;
6
+ private static scheduledFrame;
7
7
  private static animations;
8
8
  static start<R extends object>(key: string, animation: Animation<R>): void;
9
+ private static scheduleNextFrame;
10
+ private static cancelScheduledFrame;
11
+ private static cancelScheduledFrameIfIdle;
9
12
  private static tick;
10
13
  static running(key: string): boolean;
11
14
  static cancel(key: string): void;
15
+ static reset(): void;
12
16
  }
@@ -1,5 +1,12 @@
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;
4
11
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
12
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
@@ -1,9 +1,7 @@
1
1
  import { getScrollBars } from "../scene/scrollbars";
2
- import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
2
+ import type { InteractiveSceneRenderConfig } from "../scene/types";
3
3
  declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
4
4
  scrollBars?: ReturnType<typeof getScrollBars>;
5
- atLeastOneVisibleElement: boolean;
6
- elementsMap: RenderableElementsMap;
7
5
  animationState?: typeof animationState;
8
6
  };
9
7
  /**