@excalidraw/math 0.18.0-c158187 → 0.18.0-c1dbbdf

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 (121) hide show
  1. package/dist/dev/index.js +3 -3
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/colors.d.ts +57 -40
  6. package/dist/types/common/src/constants.d.ts +4 -0
  7. package/dist/types/common/src/editorInterface.d.ts +1 -1
  8. package/dist/types/common/src/index.d.ts +1 -1
  9. package/dist/types/common/src/utils.d.ts +3 -5
  10. package/dist/types/element/src/Scene.d.ts +2 -0
  11. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  12. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  13. package/dist/types/element/src/binding.d.ts +13 -8
  14. package/dist/types/element/src/collision.d.ts +4 -3
  15. package/dist/types/element/src/distribute.d.ts +2 -1
  16. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  17. package/dist/types/element/src/index.d.ts +2 -0
  18. package/dist/types/element/src/linearElementEditor.d.ts +5 -0
  19. package/dist/types/element/src/mutateElement.d.ts +2 -0
  20. package/dist/types/element/src/types.d.ts +1 -1
  21. package/dist/types/element/src/utils.d.ts +5 -3
  22. package/dist/types/element/src/zindex.d.ts +1 -1
  23. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -27
  24. package/dist/types/excalidraw/actions/actionBoundText.d.ts +20 -18
  25. package/dist/types/excalidraw/actions/actionCanvas.d.ts +121 -109
  26. package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -18
  27. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -9
  28. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +32 -27
  29. package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -9
  30. package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -18
  31. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +10 -9
  32. package/dist/types/excalidraw/actions/actionExport.d.ts +42 -42
  33. package/dist/types/excalidraw/actions/actionFrame.d.ts +40 -36
  34. package/dist/types/excalidraw/actions/actionGroup.d.ts +20 -18
  35. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +12 -9
  36. package/dist/types/excalidraw/actions/actionLink.d.ts +10 -9
  37. package/dist/types/excalidraw/actions/actionMenu.d.ts +6 -9
  38. package/dist/types/excalidraw/actions/actionProperties.d.ts +20 -18
  39. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +10 -9
  40. package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -9
  41. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
  42. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -9
  43. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
  44. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -9
  45. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +6 -9
  46. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -9
  47. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -9
  48. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -9
  49. package/dist/types/excalidraw/actions/index.d.ts +2 -0
  50. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  51. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  52. package/dist/types/excalidraw/appState.d.ts +9 -7
  53. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  54. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  55. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  56. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  57. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  58. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  59. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  60. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  61. package/dist/types/excalidraw/clipboard.d.ts +4 -4
  62. package/dist/types/excalidraw/components/App.d.ts +10 -3
  63. package/dist/types/excalidraw/components/Card.d.ts +1 -2
  64. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +0 -5
  65. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -1
  66. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
  67. package/dist/types/excalidraw/components/FilledButton.d.ts +1 -0
  68. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  69. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  70. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  71. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  72. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  73. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  74. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  75. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  76. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  77. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
  78. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  79. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -28
  80. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  81. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -1
  82. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  83. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  84. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  85. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  86. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +14 -13
  87. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  88. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  89. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  90. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  91. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  92. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  93. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -0
  94. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  95. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  96. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  97. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  98. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
  99. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
  100. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
  101. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  102. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
  103. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  104. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  105. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  106. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  107. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  108. package/dist/types/excalidraw/components/icons.d.ts +11 -2
  109. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +17 -0
  110. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
  111. package/dist/types/excalidraw/components/shapes.d.ts +74 -1
  112. package/dist/types/excalidraw/data/blob.d.ts +32 -30
  113. package/dist/types/excalidraw/data/json.d.ts +16 -15
  114. package/dist/types/excalidraw/errors.d.ts +14 -0
  115. package/dist/types/excalidraw/index.d.ts +4 -0
  116. package/dist/types/excalidraw/types.d.ts +24 -13
  117. package/dist/types/math/src/point.d.ts +6 -1
  118. package/dist/types/math/src/types.d.ts +25 -1
  119. package/package.json +2 -2
  120. package/dist/types/common/src/visualdebug.d.ts +0 -41
  121. package/dist/types/excalidraw/charts.d.ts +0 -27
@@ -46,12 +46,21 @@ fileHandle?: FileSystemHandle | null) => Promise<{
46
46
  } | {
47
47
  name: "elementLinkSelector";
48
48
  sourceElementId: ExcalidrawElement["id"];
49
+ } | {
50
+ name: "charts";
51
+ data: import("../charts").Spreadsheet;
52
+ rawText: string;
49
53
  };
50
54
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
51
55
  selectedElementIds: Readonly<{
52
56
  [id: string]: true;
53
57
  }>;
54
58
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
59
+ activeTool: {
60
+ lastActiveTool: import("../types").ActiveTool | null;
61
+ locked: boolean;
62
+ fromSelection: boolean;
63
+ } & import("../types").ActiveTool;
55
64
  activeEmbeddable: {
56
65
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
57
66
  state: "hover" | "active";
@@ -64,7 +73,11 @@ fileHandle?: FileSystemHandle | null) => Promise<{
64
73
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
65
74
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
66
75
  isBindingEnabled: boolean;
67
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
76
+ isMidpointSnappingEnabled: boolean;
77
+ suggestedBinding: {
78
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
79
+ midPoint?: import("@excalidraw/math").GlobalPoint;
80
+ } | null;
68
81
  isRotating: boolean;
69
82
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
70
83
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
@@ -83,6 +96,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
83
96
  }>;
84
97
  shouldCacheIgnoreZoom: boolean;
85
98
  exportScale: number;
99
+ currentItemArrowType: "sharp" | "round" | "elbow";
86
100
  bindMode: import("@excalidraw/element/types").BindMode;
87
101
  gridSize: number;
88
102
  contextMenu: {
@@ -94,13 +108,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
94
108
  isLoading: boolean;
95
109
  errorMessage: React.ReactNode;
96
110
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
111
+ bindingPreference: "enabled" | "disabled";
97
112
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
98
113
  editingFrame: string | null;
99
- activeTool: {
100
- lastActiveTool: import("../types").ActiveTool | null;
101
- locked: boolean;
102
- fromSelection: boolean;
103
- } & import("../types").ActiveTool;
104
114
  preferredSelectionTool: {
105
115
  type: "selection" | "lasso";
106
116
  initialized: boolean;
@@ -124,7 +134,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
124
134
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
125
135
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
126
136
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
127
- currentItemArrowType: "sharp" | "round" | "elbow";
128
137
  cursorButton: "up" | "down";
129
138
  scrolledOutside: boolean;
130
139
  isResizing: boolean;
@@ -152,14 +161,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
152
161
  open: boolean;
153
162
  panels: number;
154
163
  };
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
164
  showHyperlinkPopup: false | "info" | "editor";
164
165
  originSnapOffset: {
165
166
  x: number;
@@ -210,12 +211,21 @@ fileHandle?: FileSystemHandle | null) => Promise<{
210
211
  } | {
211
212
  name: "elementLinkSelector";
212
213
  sourceElementId: ExcalidrawElement["id"];
214
+ } | {
215
+ name: "charts";
216
+ data: import("../charts").Spreadsheet;
217
+ rawText: string;
213
218
  };
214
219
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
215
220
  selectedElementIds: Readonly<{
216
221
  [id: string]: true;
217
222
  }>;
218
223
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
224
+ activeTool: {
225
+ lastActiveTool: import("../types").ActiveTool | null;
226
+ locked: boolean;
227
+ fromSelection: boolean;
228
+ } & import("../types").ActiveTool;
219
229
  activeEmbeddable: {
220
230
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
221
231
  state: "hover" | "active";
@@ -228,7 +238,11 @@ fileHandle?: FileSystemHandle | null) => Promise<{
228
238
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
229
239
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
230
240
  isBindingEnabled: boolean;
231
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
241
+ isMidpointSnappingEnabled: boolean;
242
+ suggestedBinding: {
243
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
244
+ midPoint?: import("@excalidraw/math").GlobalPoint;
245
+ } | null;
232
246
  isRotating: boolean;
233
247
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
234
248
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
@@ -247,6 +261,7 @@ fileHandle?: FileSystemHandle | null) => Promise<{
247
261
  }>;
248
262
  shouldCacheIgnoreZoom: boolean;
249
263
  exportScale: number;
264
+ currentItemArrowType: "sharp" | "round" | "elbow";
250
265
  bindMode: import("@excalidraw/element/types").BindMode;
251
266
  gridSize: number;
252
267
  contextMenu: {
@@ -258,13 +273,9 @@ fileHandle?: FileSystemHandle | null) => Promise<{
258
273
  isLoading: boolean;
259
274
  errorMessage: React.ReactNode;
260
275
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
276
+ bindingPreference: "enabled" | "disabled";
261
277
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
262
278
  editingFrame: string | null;
263
- activeTool: {
264
- lastActiveTool: import("../types").ActiveTool | null;
265
- locked: boolean;
266
- fromSelection: boolean;
267
- } & import("../types").ActiveTool;
268
279
  preferredSelectionTool: {
269
280
  type: "selection" | "lasso";
270
281
  initialized: boolean;
@@ -288,7 +299,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
288
299
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
289
300
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
290
301
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
291
- currentItemArrowType: "sharp" | "round" | "elbow";
292
302
  cursorButton: "up" | "down";
293
303
  scrolledOutside: boolean;
294
304
  isResizing: boolean;
@@ -316,14 +326,6 @@ fileHandle?: FileSystemHandle | null) => Promise<{
316
326
  open: boolean;
317
327
  panels: number;
318
328
  };
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
329
  showHyperlinkPopup: false | "info" | "editor";
328
330
  originSnapOffset: {
329
331
  x: number;
@@ -35,12 +35,21 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
35
35
  } | {
36
36
  name: "elementLinkSelector";
37
37
  sourceElementId: ExcalidrawElement["id"];
38
+ } | {
39
+ name: "charts";
40
+ data: import("../charts").Spreadsheet;
41
+ rawText: string;
38
42
  };
39
43
  editingGroupId: import("@excalidraw/element/types").GroupId | null;
40
44
  selectedElementIds: Readonly<{
41
45
  [id: string]: true;
42
46
  }>;
43
47
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
48
+ activeTool: {
49
+ lastActiveTool: import("../types").ActiveTool | null;
50
+ locked: boolean;
51
+ fromSelection: boolean;
52
+ } & import("../types").ActiveTool;
44
53
  activeEmbeddable: {
45
54
  element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
46
55
  state: "hover" | "active";
@@ -53,7 +62,11 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
53
62
  multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
54
63
  newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
55
64
  isBindingEnabled: boolean;
56
- suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
65
+ isMidpointSnappingEnabled: boolean;
66
+ suggestedBinding: {
67
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
68
+ midPoint?: import("@excalidraw/math").GlobalPoint;
69
+ } | null;
57
70
  isRotating: boolean;
58
71
  elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
59
72
  collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
@@ -72,6 +85,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
72
85
  }>;
73
86
  shouldCacheIgnoreZoom: boolean;
74
87
  exportScale: number;
88
+ currentItemArrowType: "sharp" | "round" | "elbow";
75
89
  bindMode: import("@excalidraw/element/types").BindMode;
76
90
  gridSize: number;
77
91
  contextMenu: {
@@ -83,13 +97,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
83
97
  isLoading: boolean;
84
98
  errorMessage: React.ReactNode;
85
99
  resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
100
+ bindingPreference: "enabled" | "disabled";
86
101
  startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
87
102
  editingFrame: string | null;
88
- activeTool: {
89
- lastActiveTool: import("../types").ActiveTool | null;
90
- locked: boolean;
91
- fromSelection: boolean;
92
- } & import("../types").ActiveTool;
93
103
  preferredSelectionTool: {
94
104
  type: "selection" | "lasso";
95
105
  initialized: boolean;
@@ -113,7 +123,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
113
123
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
114
124
  currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
115
125
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
116
- currentItemArrowType: "sharp" | "round" | "elbow";
117
126
  cursorButton: "up" | "down";
118
127
  scrolledOutside: boolean;
119
128
  isResizing: boolean;
@@ -141,14 +150,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
141
150
  open: boolean;
142
151
  panels: number;
143
152
  };
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
153
  showHyperlinkPopup: false | "info" | "editor";
153
154
  originSnapOffset: {
154
155
  x: number;
@@ -26,4 +26,18 @@ export declare class WorkerInTheMainChunkError extends Error {
26
26
  export declare class ExcalidrawError extends Error {
27
27
  constructor(message: string);
28
28
  }
29
+ export declare class RequestError extends Error {
30
+ status: number;
31
+ data: any;
32
+ toObject(): {
33
+ name: string;
34
+ status: number;
35
+ message: string;
36
+ };
37
+ constructor({ message, status, data, }?: {
38
+ message?: string;
39
+ status?: number;
40
+ data?: any;
41
+ });
42
+ }
29
43
  export {};
@@ -35,6 +35,8 @@ export { Stats } from "./components/Stats";
35
35
  export { DefaultSidebar } from "./components/DefaultSidebar";
36
36
  export { TTDDialog } from "./components/TTDDialog/TTDDialog";
37
37
  export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
38
+ export { TTDStreamFetch } from "./components/TTDDialog/utils/TTDStreamFetch";
39
+ export type { TTDPersistenceAdapter, SavedChat, SavedChats, } from "./components/TTDDialog/types";
38
40
  export { zoomToFitBounds } from "./actions/actionCanvas";
39
41
  export { getCommonBounds, getVisibleSceneBounds, convertToExcalidrawElements, } from "@excalidraw/element";
40
42
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "@excalidraw/utils/withinBounds";
@@ -42,3 +44,5 @@ export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToC
42
44
  export { getDataURL } from "./data/blob";
43
45
  export { isElementLink } from "@excalidraw/element";
44
46
  export { setCustomTextMetricsProvider } from "@excalidraw/element";
47
+ export { CommandPalette } from "./components/CommandPalette/CommandPalette";
48
+ export { renderSpreadsheet, tryParseSpreadsheet, isSpreadsheetValidForChartType, } from "./charts";
@@ -1,9 +1,10 @@
1
1
  import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
2
2
  import type { LinearElementEditor } from "@excalidraw/element";
3
3
  import type { MaybeTransformHandleType } from "@excalidraw/element";
4
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
5
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
6
  import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
+ import type { GlobalPoint } from "@excalidraw/math";
7
8
  import type { Action } from "./actions/types";
8
9
  import type { Spreadsheet } from "./charts";
9
10
  import type { ClipboardData } from "./clipboard";
@@ -17,6 +18,7 @@ import type { Language } from "./i18n";
17
18
  import type { isOverScrollBars } from "./scene/scrollbars";
18
19
  import type React from "react";
19
20
  import type { JSX } from "react";
21
+ export type { App };
20
22
  export type SocketId = string & {
21
23
  _brand: "SocketId";
22
24
  };
@@ -128,6 +130,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
128
130
  croppingElementId: AppState["croppingElementId"];
129
131
  }>;
130
132
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
133
+ activeTool: AppState["activeTool"];
131
134
  activeEmbeddable: AppState["activeEmbeddable"];
132
135
  selectionElement: AppState["selectionElement"];
133
136
  selectedGroupIds: AppState["selectedGroupIds"];
@@ -135,6 +138,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
135
138
  multiElement: AppState["multiElement"];
136
139
  newElement: AppState["newElement"];
137
140
  isBindingEnabled: AppState["isBindingEnabled"];
141
+ isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
138
142
  suggestedBinding: AppState["suggestedBinding"];
139
143
  isRotating: AppState["isRotating"];
140
144
  elementsToHighlight: AppState["elementsToHighlight"];
@@ -150,6 +154,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
150
154
  frameRendering: AppState["frameRendering"];
151
155
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
152
156
  exportScale: AppState["exportScale"];
157
+ currentItemArrowType: AppState["currentItemArrowType"];
153
158
  }>;
154
159
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
155
160
  export type ObservedStandaloneAppState = {
@@ -201,9 +206,20 @@ export interface AppState {
201
206
  * - set on pointer down, updated during pointer move
202
207
  */
203
208
  selectionElement: NonDeletedExcalidrawElement | null;
209
+ /**
210
+ * tracking current arrow binding editor state (takes into account
211
+ * `bindingPreference` and keyboard modifiers (ctrl/alt)
212
+ */
204
213
  isBindingEnabled: boolean;
214
+ /** user arrow binding preference */
215
+ bindingPreference: "enabled" | "disabled";
216
+ /** user preference whether arrow snap to midpoints while binding */
217
+ isMidpointSnappingEnabled: boolean;
205
218
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
206
- suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
219
+ suggestedBinding: {
220
+ element: NonDeleted<ExcalidrawBindableElement>;
221
+ midPoint?: GlobalPoint;
222
+ } | null;
207
223
  frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
208
224
  frameRendering: {
209
225
  enabled: boolean;
@@ -278,6 +294,10 @@ export interface AppState {
278
294
  } | {
279
295
  name: "elementLinkSelector";
280
296
  sourceElementId: ExcalidrawElement["id"];
297
+ } | {
298
+ name: "charts";
299
+ data: Spreadsheet;
300
+ rawText: string;
281
301
  };
282
302
  /**
283
303
  * Reflects user preference for whether the default sidebar should be docked.
@@ -329,14 +349,6 @@ export interface AppState {
329
349
  /** bitmap. Use `STATS_PANELS` bit values */
330
350
  panels: number;
331
351
  };
332
- currentChartType: ChartType;
333
- pasteDialog: {
334
- shown: false;
335
- data: null;
336
- } | {
337
- shown: true;
338
- data: Spreadsheet;
339
- };
340
352
  showHyperlinkPopup: false | "info" | "editor";
341
353
  selectedLinearElement: LinearElementEditor | null;
342
354
  snapLines: readonly SnapLine[];
@@ -515,8 +527,7 @@ export type UIOptions = Partial<{
515
527
  * Optionally control the editor form factor and desktop UI mode from the host app.
516
528
  * If not provided, we will take care of it internally.
517
529
  */
518
- formFactor?: EditorInterface["formFactor"];
519
- desktopUIMode?: EditorInterface["desktopUIMode"];
530
+ getFormFactor?: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
520
531
  /** @deprecated does nothing. Will be removed in 0.15 */
521
532
  welcomeScreen?: boolean;
522
533
  }>;
@@ -577,6 +588,7 @@ export type AppClassProperties = {
577
588
  onPointerUpEmitter: App["onPointerUpEmitter"];
578
589
  updateEditorAtom: App["updateEditorAtom"];
579
590
  onPointerDownEmitter: App["onPointerDownEmitter"];
591
+ lastPointerMoveCoords: App["lastPointerMoveCoords"];
580
592
  bindModeHandler: App["bindModeHandler"];
581
593
  };
582
594
  export type PointerDownState = Readonly<{
@@ -716,4 +728,3 @@ export type Offsets = Partial<{
716
728
  bottom: number;
717
729
  left: number;
718
730
  }>;
719
- export {};
@@ -1,4 +1,4 @@
1
- import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types";
1
+ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector, GlobalCoord, LocalCoord } from "./types";
2
2
  /**
3
3
  * Create a properly typed Point instance from the X and Y coordinates.
4
4
  *
@@ -7,6 +7,11 @@ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types"
7
7
  * @returns The branded and created point
8
8
  */
9
9
  export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(x: number, y: number): Point;
10
+ export declare function pointFrom<Coord extends GlobalCoord | LocalCoord>(coords: Coord): Coord extends GlobalCoord ? GlobalPoint : LocalPoint;
11
+ export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(coords: {
12
+ x: number;
13
+ y: number;
14
+ }): Point;
10
15
  /**
11
16
  * Converts and remaps an array containing a pair of numbers to Point.
12
17
  *
@@ -19,12 +19,24 @@ export type InclusiveRange = [number, number] & {
19
19
  _brand: "excalimath_degree";
20
20
  };
21
21
  /**
22
- * Represents a 2D position in world or canvas space. A
22
+ * Represents a 2D position in world/canvas/scene space. A
23
23
  * global coordinate.
24
24
  */
25
25
  export type GlobalPoint = [x: number, y: number] & {
26
26
  _brand: "excalimath__globalpoint";
27
27
  };
28
+ /**
29
+ * Represents a 2D position in world/canvas/scene space. A
30
+ * global coordinate.
31
+ *
32
+ * TODO remove this once we migrate the codebase to use Point tuples everywhere
33
+ */
34
+ export type GlobalCoord = {
35
+ x: number;
36
+ y: number;
37
+ } & {
38
+ _brand: "excalimath__globalcoord";
39
+ };
28
40
  /**
29
41
  * Represents a 2D position in whatever local space it's
30
42
  * needed. A local coordinate.
@@ -32,6 +44,18 @@ export type GlobalPoint = [x: number, y: number] & {
32
44
  export type LocalPoint = [x: number, y: number] & {
33
45
  _brand: "excalimath__localpoint";
34
46
  };
47
+ /**
48
+ * Represents a 2D position in whatever local space it's needed.
49
+ * A local coordinate.
50
+ *
51
+ * TODO remove this once we migrate the codebase to use Point tuples everywhere
52
+ */
53
+ export type LocalCoord = {
54
+ x: number;
55
+ y: number;
56
+ } & {
57
+ _brand: "excalimath__localcoord";
58
+ };
35
59
  /**
36
60
  * A line is an infinitely long object with no width, depth, or curvature.
37
61
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/math",
3
- "version": "0.18.0-c158187",
3
+ "version": "0.18.0-c1dbbdf",
4
4
  "type": "module",
5
5
  "types": "./dist/types/math/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -61,6 +61,6 @@
61
61
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
62
62
  },
63
63
  "dependencies": {
64
- "@excalidraw/common": "0.18.0-c158187"
64
+ "@excalidraw/common": "0.18.0-c1dbbdf"
65
65
  }
66
66
  }
@@ -1,41 +0,0 @@
1
- import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
- import type { Curve } from "@excalidraw/math";
3
- import type { LineSegment } from "@excalidraw/utils";
4
- import { type Bounds } from "./bounds";
5
- declare global {
6
- interface Window {
7
- visualDebug?: {
8
- data: DebugElement[][];
9
- currentFrame?: number;
10
- };
11
- }
12
- }
13
- export type DebugElement = {
14
- color: string;
15
- data: LineSegment<GlobalPoint> | Curve<GlobalPoint>;
16
- permanent: boolean;
17
- };
18
- export declare const debugDrawCubicBezier: (c: Curve<GlobalPoint>, opts?: {
19
- color?: string;
20
- permanent?: boolean;
21
- }) => void;
22
- export declare const debugDrawLine: (segment: LineSegment<GlobalPoint> | LineSegment<GlobalPoint>[], opts?: {
23
- color?: string;
24
- permanent?: boolean;
25
- }) => void;
26
- export declare const debugDrawPoint: (p: GlobalPoint, opts?: {
27
- color?: string;
28
- permanent?: boolean;
29
- fuzzy?: boolean;
30
- }) => void;
31
- export declare const debugDrawBounds: (box: Bounds | Bounds[], opts?: {
32
- color?: string;
33
- permanent?: boolean;
34
- }) => void;
35
- export declare const debugDrawPoints: ({ x, y, points, }: {
36
- x: number;
37
- y: number;
38
- points: readonly LocalPoint[];
39
- }, options?: any) => void;
40
- export declare const debugCloseFrame: () => void;
41
- export declare const debugClear: () => void;
@@ -1,27 +0,0 @@
1
- import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- export type ChartElements = readonly NonDeletedExcalidrawElement[];
3
- export interface Spreadsheet {
4
- title: string | null;
5
- labels: string[] | null;
6
- values: number[];
7
- }
8
- export declare const NOT_SPREADSHEET = "NOT_SPREADSHEET";
9
- export declare const VALID_SPREADSHEET = "VALID_SPREADSHEET";
10
- type ParseSpreadsheetResult = {
11
- type: typeof NOT_SPREADSHEET;
12
- reason: string;
13
- } | {
14
- type: typeof VALID_SPREADSHEET;
15
- spreadsheet: Spreadsheet;
16
- };
17
- /**
18
- * @private exported for testing
19
- */
20
- export declare const tryParseNumber: (s: string) => number | null;
21
- /**
22
- * @private exported for testing
23
- */
24
- export declare const tryParseCells: (cells: string[][]) => ParseSpreadsheetResult;
25
- export declare const tryParseSpreadsheet: (text: string) => ParseSpreadsheetResult;
26
- export declare const renderSpreadsheet: (chartType: string, spreadsheet: Spreadsheet, x: number, y: number) => ChartElements;
27
- export {};