@excalidraw/math 0.18.0-abeeaeb → 0.18.0-afa3a65

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 (79) hide show
  1. package/dist/dev/index.js +36 -42
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/src/colors.d.ts +8 -0
  5. package/dist/types/common/src/constants.d.ts +44 -0
  6. package/dist/types/common/src/keys.d.ts +2 -0
  7. package/dist/types/common/src/random.d.ts +7 -0
  8. package/dist/types/element/src/Scene.d.ts +1 -1
  9. package/dist/types/element/src/comparisons.d.ts +5 -3
  10. package/dist/types/element/src/delta.d.ts +23 -1
  11. package/dist/types/element/src/flowchart.d.ts +5 -1
  12. package/dist/types/element/src/frame.d.ts +2 -2
  13. package/dist/types/element/src/index.d.ts +1 -0
  14. package/dist/types/element/src/linearElementEditor.d.ts +10 -0
  15. package/dist/types/element/src/mutateElement.d.ts +1 -1
  16. package/dist/types/element/src/newElement.d.ts +24 -2
  17. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  18. package/dist/types/element/src/stickyNote.d.ts +183 -0
  19. package/dist/types/element/src/textElement.d.ts +2 -1
  20. package/dist/types/element/src/transform.d.ts +25 -6
  21. package/dist/types/element/src/typeChecks.d.ts +3 -2
  22. package/dist/types/element/src/types.d.ts +35 -6
  23. package/dist/types/element/src/utils.d.ts +7 -3
  24. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +12 -0
  25. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  26. package/dist/types/excalidraw/actions/actionBoundText.d.ts +8 -0
  27. package/dist/types/excalidraw/actions/actionCanvas.d.ts +28 -0
  28. package/dist/types/excalidraw/actions/actionClipboard.d.ts +8 -0
  29. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +4 -0
  30. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +13 -1
  31. package/dist/types/excalidraw/actions/actionDeselect.d.ts +4 -0
  32. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  33. package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -0
  34. package/dist/types/excalidraw/actions/actionElementLock.d.ts +8 -0
  35. package/dist/types/excalidraw/actions/actionExport.d.ts +8 -0
  36. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  37. package/dist/types/excalidraw/actions/actionFrame.d.ts +63 -1
  38. package/dist/types/excalidraw/actions/actionGroup.d.ts +8 -0
  39. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +55 -1
  40. package/dist/types/excalidraw/actions/actionLink.d.ts +4 -0
  41. package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -0
  42. package/dist/types/excalidraw/actions/actionProperties.d.ts +18 -6
  43. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -0
  44. package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -1
  45. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +4 -0
  46. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +4 -0
  47. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +4 -0
  48. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -0
  49. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -0
  50. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +4 -0
  51. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -0
  52. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -0
  53. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  54. package/dist/types/excalidraw/appState.d.ts +4 -0
  55. package/dist/types/excalidraw/components/App.arrowText.d.ts +40 -8
  56. package/dist/types/excalidraw/components/App.cursor.d.ts +8 -0
  57. package/dist/types/excalidraw/components/App.d.ts +92 -6
  58. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  59. package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
  60. package/dist/types/excalidraw/components/Tools.d.ts +7 -2
  61. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  62. package/dist/types/excalidraw/components/icons.d.ts +1 -0
  63. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
  64. package/dist/types/excalidraw/data/blob.d.ts +8 -0
  65. package/dist/types/excalidraw/data/json.d.ts +4 -0
  66. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  67. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  68. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  69. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  70. package/dist/types/excalidraw/scene/Renderer.d.ts +50 -1
  71. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  72. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  73. package/dist/types/excalidraw/types.d.ts +30 -2
  74. package/dist/types/excalidraw/viewport.d.ts +4 -0
  75. package/dist/types/math/src/curve.d.ts +19 -12
  76. package/dist/types/math/src/segment.d.ts +6 -0
  77. package/dist/types/utils/src/export.d.ts +1 -0
  78. package/dist/types/utils/src/shape.d.ts +2 -2
  79. package/package.json +2 -2
@@ -1,18 +1,22 @@
1
1
  import { type StrokeWidthKey } from "@excalidraw/common";
2
2
  import { LinearElementEditor } from "@excalidraw/element";
3
- import type { Arrowhead, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextElement, FontFamilyValues, StrokeVariability, NonDeleted, NonDeletedExcalidrawElement, TextAlign } from "@excalidraw/element/types";
3
+ import type { Arrowhead, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, ExcalidrawTextElement, FontFamilyValues, StrokeVariability, NonDeleted, NonDeletedExcalidrawElement, TextAlign } from "@excalidraw/element/types";
4
4
  import type { AppClassProperties, AppState, Primitive } from "../types";
5
- export declare const changeProperty: (elements: readonly ExcalidrawElement[], appState: AppState, callback: (element: NonDeletedExcalidrawElement) => ExcalidrawElement, includeBoundText?: boolean) => ExcalidrawElement[];
5
+ export declare const changeProperty: (elements: readonly ExcalidrawElement[], appState: AppState, callback: (element: NonDeletedExcalidrawElement) => ExcalidrawElement, includeBoundText?: boolean) => (ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawStickyNoteElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement)[];
6
6
  export declare const getFormValue: <T extends Primitive>(elements: readonly ExcalidrawElement[], app: AppClassProperties,
7
7
  /**
8
8
  * input value (usually the element attribute value,
9
9
  * but depends on what the action's PanelComponent input expects)
10
10
  */
11
11
  getValue: (element: ExcalidrawElement) => T, elementPredicate: true | ((element: ExcalidrawElement) => boolean), defaultValue: T | ((isSomeElementSelected: boolean) => T)) => T;
12
- export declare const actionChangeStrokeColor: import("./types").Action<Pick<AppState, "currentItemStrokeColor">> & {
12
+ export declare const actionChangeStrokeColor: import("./types").Action<Partial<AppState> & {
13
+ color?: string;
14
+ }> & {
13
15
  keyTest?: ((event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean) | undefined;
14
16
  };
15
- export declare const actionChangeBackgroundColor: import("./types").Action<Pick<AppState, "viewBackgroundColor" | "currentItemBackgroundColor">> & {
17
+ export declare const actionChangeBackgroundColor: import("./types").Action<Partial<AppState> & {
18
+ color?: string;
19
+ }> & {
16
20
  keyTest?: ((event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean) | undefined;
17
21
  };
18
22
  export declare const actionChangeBucketFillBackgroundColor: import("./types").Action<Pick<AppState, "currentItemBackgroundColor">> & {
@@ -45,7 +49,7 @@ export declare const actionDecreaseFontSize: {
45
49
  icon: import("react/jsx-runtime").JSX.Element;
46
50
  trackEvent: false;
47
51
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, value: unknown, app: AppClassProperties) => {
48
- elements: ExcalidrawElement[];
52
+ elements: (ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawStickyNoteElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement)[];
49
53
  appState: {
50
54
  currentItemFontSize: number;
51
55
  contextMenu: {
@@ -102,6 +106,8 @@ export declare const actionDecreaseFontSize: {
102
106
  exportWithDarkMode: boolean;
103
107
  exportScale: number;
104
108
  currentItemStrokeColor: string;
109
+ currentItemStickynoteStrokeColor: string;
110
+ currentItemStickynoteBackgroundColor: string;
105
111
  currentItemBackgroundColor: string;
106
112
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
107
113
  currentItemStrokeWidthKey: StrokeWidthKey;
@@ -210,6 +216,8 @@ export declare const actionDecreaseFontSize: {
210
216
  elementStroke: readonly string[] | null;
211
217
  elementBackground: readonly string[] | null;
212
218
  bucketFill: readonly string[] | null;
219
+ stickyNoteStroke: readonly string[] | null;
220
+ stickyNoteBackground: readonly string[] | null;
213
221
  };
214
222
  };
215
223
  captureUpdate: "IMMEDIATELY";
@@ -224,7 +232,7 @@ export declare const actionIncreaseFontSize: {
224
232
  icon: import("react/jsx-runtime").JSX.Element;
225
233
  trackEvent: false;
226
234
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, value: unknown, app: AppClassProperties) => {
227
- elements: ExcalidrawElement[];
235
+ elements: (ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawStickyNoteElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | ExcalidrawFreeDrawElement)[];
228
236
  appState: {
229
237
  currentItemFontSize: number;
230
238
  contextMenu: {
@@ -281,6 +289,8 @@ export declare const actionIncreaseFontSize: {
281
289
  exportWithDarkMode: boolean;
282
290
  exportScale: number;
283
291
  currentItemStrokeColor: string;
292
+ currentItemStickynoteStrokeColor: string;
293
+ currentItemStickynoteBackgroundColor: string;
284
294
  currentItemBackgroundColor: string;
285
295
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
286
296
  currentItemStrokeWidthKey: StrokeWidthKey;
@@ -389,6 +399,8 @@ export declare const actionIncreaseFontSize: {
389
399
  elementStroke: readonly string[] | null;
390
400
  elementBackground: readonly string[] | null;
391
401
  bucketFill: readonly string[] | null;
402
+ stickyNoteStroke: readonly string[] | null;
403
+ stickyNoteBackground: readonly string[] | null;
392
404
  };
393
405
  };
394
406
  captureUpdate: "IMMEDIATELY";
@@ -68,6 +68,8 @@ export declare const actionSelectAll: {
68
68
  exportWithDarkMode: boolean;
69
69
  exportScale: number;
70
70
  currentItemStrokeColor: string;
71
+ currentItemStickynoteStrokeColor: string;
72
+ currentItemStickynoteBackgroundColor: string;
71
73
  currentItemBackgroundColor: string;
72
74
  currentItemFillStyle: ExcalidrawElement["fillStyle"];
73
75
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -169,6 +171,8 @@ export declare const actionSelectAll: {
169
171
  elementStroke: readonly string[] | null;
170
172
  elementBackground: readonly string[] | null;
171
173
  bucketFill: readonly string[] | null;
174
+ stickyNoteStroke: readonly string[] | null;
175
+ stickyNoteBackground: readonly string[] | null;
172
176
  };
173
177
  };
174
178
  captureUpdate: "IMMEDIATELY";
@@ -66,6 +66,8 @@ export declare const actionCopyStyles: {
66
66
  exportWithDarkMode: boolean;
67
67
  exportScale: number;
68
68
  currentItemStrokeColor: string;
69
+ currentItemStickynoteStrokeColor: string;
70
+ currentItemStickynoteBackgroundColor: string;
69
71
  currentItemBackgroundColor: string;
70
72
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
71
73
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -170,6 +172,8 @@ export declare const actionCopyStyles: {
170
172
  elementStroke: readonly string[] | null;
171
173
  elementBackground: readonly string[] | null;
172
174
  bucketFill: readonly string[] | null;
175
+ stickyNoteStroke: readonly string[] | null;
176
+ stickyNoteBackground: readonly string[] | null;
173
177
  };
174
178
  };
175
179
  captureUpdate: "EVENTUALLY";
@@ -189,7 +193,7 @@ export declare const actionPasteStyles: {
189
193
  elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
190
194
  captureUpdate: "EVENTUALLY";
191
195
  } | {
192
- elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
196
+ elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
193
197
  captureUpdate: "IMMEDIATELY";
194
198
  };
195
199
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
@@ -62,6 +62,8 @@ export declare const actionToggleArrowBinding: {
62
62
  exportWithDarkMode: boolean;
63
63
  exportScale: number;
64
64
  currentItemStrokeColor: string;
65
+ currentItemStickynoteStrokeColor: string;
66
+ currentItemStickynoteBackgroundColor: string;
65
67
  currentItemBackgroundColor: string;
66
68
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
67
69
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -171,6 +173,8 @@ export declare const actionToggleArrowBinding: {
171
173
  elementStroke: readonly string[] | null;
172
174
  elementBackground: readonly string[] | null;
173
175
  bucketFill: readonly string[] | null;
176
+ stickyNoteStroke: readonly string[] | null;
177
+ stickyNoteBackground: readonly string[] | null;
174
178
  };
175
179
  };
176
180
  captureUpdate: "NEVER";
@@ -66,6 +66,8 @@ export declare const actionToggleGridMode: {
66
66
  exportWithDarkMode: boolean;
67
67
  exportScale: number;
68
68
  currentItemStrokeColor: string;
69
+ currentItemStickynoteStrokeColor: string;
70
+ currentItemStickynoteBackgroundColor: string;
69
71
  currentItemBackgroundColor: string;
70
72
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
71
73
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -173,6 +175,8 @@ export declare const actionToggleGridMode: {
173
175
  elementStroke: readonly string[] | null;
174
176
  elementBackground: readonly string[] | null;
175
177
  bucketFill: readonly string[] | null;
178
+ stickyNoteStroke: readonly string[] | null;
179
+ stickyNoteBackground: readonly string[] | null;
176
180
  };
177
181
  };
178
182
  captureUpdate: "EVENTUALLY";
@@ -62,6 +62,8 @@ export declare const actionToggleMidpointSnapping: {
62
62
  exportWithDarkMode: boolean;
63
63
  exportScale: number;
64
64
  currentItemStrokeColor: string;
65
+ currentItemStickynoteStrokeColor: string;
66
+ currentItemStickynoteBackgroundColor: string;
65
67
  currentItemBackgroundColor: string;
66
68
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
67
69
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -171,6 +173,8 @@ export declare const actionToggleMidpointSnapping: {
171
173
  elementStroke: readonly string[] | null;
172
174
  elementBackground: readonly string[] | null;
173
175
  bucketFill: readonly string[] | null;
176
+ stickyNoteStroke: readonly string[] | null;
177
+ stickyNoteBackground: readonly string[] | null;
174
178
  };
175
179
  };
176
180
  captureUpdate: "NEVER";
@@ -65,6 +65,8 @@ export declare const actionToggleObjectsSnapMode: {
65
65
  exportWithDarkMode: boolean;
66
66
  exportScale: number;
67
67
  currentItemStrokeColor: string;
68
+ currentItemStickynoteStrokeColor: string;
69
+ currentItemStickynoteBackgroundColor: string;
68
70
  currentItemBackgroundColor: string;
69
71
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
70
72
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -172,6 +174,8 @@ export declare const actionToggleObjectsSnapMode: {
172
174
  elementStroke: readonly string[] | null;
173
175
  elementBackground: readonly string[] | null;
174
176
  bucketFill: readonly string[] | null;
177
+ stickyNoteStroke: readonly string[] | null;
178
+ stickyNoteBackground: readonly string[] | null;
175
179
  };
176
180
  };
177
181
  captureUpdate: "EVENTUALLY";
@@ -70,6 +70,8 @@ export declare const actionToggleSearchMenu: {
70
70
  exportWithDarkMode: boolean;
71
71
  exportScale: number;
72
72
  currentItemStrokeColor: string;
73
+ currentItemStickynoteStrokeColor: string;
74
+ currentItemStickynoteBackgroundColor: string;
73
75
  currentItemBackgroundColor: string;
74
76
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
75
77
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -158,6 +160,8 @@ export declare const actionToggleSearchMenu: {
158
160
  elementStroke: readonly string[] | null;
159
161
  elementBackground: readonly string[] | null;
160
162
  bucketFill: readonly string[] | null;
163
+ stickyNoteStroke: readonly string[] | null;
164
+ stickyNoteBackground: readonly string[] | null;
161
165
  };
162
166
  };
163
167
  captureUpdate: "EVENTUALLY";
@@ -67,6 +67,8 @@ export declare const actionToggleStats: {
67
67
  exportWithDarkMode: boolean;
68
68
  exportScale: number;
69
69
  currentItemStrokeColor: string;
70
+ currentItemStickynoteStrokeColor: string;
71
+ currentItemStickynoteBackgroundColor: string;
70
72
  currentItemBackgroundColor: string;
71
73
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
72
74
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -172,6 +174,8 @@ export declare const actionToggleStats: {
172
174
  elementStroke: readonly string[] | null;
173
175
  elementBackground: readonly string[] | null;
174
176
  bucketFill: readonly string[] | null;
177
+ stickyNoteStroke: readonly string[] | null;
178
+ stickyNoteBackground: readonly string[] | null;
175
179
  };
176
180
  };
177
181
  captureUpdate: "EVENTUALLY";
@@ -64,6 +64,8 @@ export declare const actionToggleViewMode: {
64
64
  exportWithDarkMode: boolean;
65
65
  exportScale: number;
66
66
  currentItemStrokeColor: string;
67
+ currentItemStickynoteStrokeColor: string;
68
+ currentItemStickynoteBackgroundColor: string;
67
69
  currentItemBackgroundColor: string;
68
70
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
69
71
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -172,6 +174,8 @@ export declare const actionToggleViewMode: {
172
174
  elementStroke: readonly string[] | null;
173
175
  elementBackground: readonly string[] | null;
174
176
  bucketFill: readonly string[] | null;
177
+ stickyNoteStroke: readonly string[] | null;
178
+ stickyNoteBackground: readonly string[] | null;
175
179
  };
176
180
  };
177
181
  captureUpdate: "EVENTUALLY";
@@ -64,6 +64,8 @@ export declare const actionToggleZenMode: {
64
64
  exportWithDarkMode: boolean;
65
65
  exportScale: number;
66
66
  currentItemStrokeColor: string;
67
+ currentItemStickynoteStrokeColor: string;
68
+ currentItemStickynoteBackgroundColor: string;
67
69
  currentItemBackgroundColor: string;
68
70
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
69
71
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -172,6 +174,8 @@ export declare const actionToggleZenMode: {
172
174
  elementStroke: readonly string[] | null;
173
175
  elementBackground: readonly string[] | null;
174
176
  bucketFill: readonly string[] | null;
177
+ stickyNoteStroke: readonly string[] | null;
178
+ stickyNoteBackground: readonly string[] | null;
175
179
  };
176
180
  };
177
181
  captureUpdate: "EVENTUALLY";
@@ -0,0 +1,39 @@
1
+ import type { ColorPaletteCustom, ColorTuple } from "@excalidraw/common";
2
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { AppState } from "../types";
4
+ export type ColorProperty = "strokeColor" | "backgroundColor";
5
+ /**
6
+ * Sticky notes are their own color domain: own defaults, own top picks, no
7
+ * transparent. A pick targets the regular domain, the sticky domain, or both
8
+ * ("mixed" selections write both defaults and use the regular picker).
9
+ */
10
+ export type ColorTargetKind = "regular" | "sticky" | "mixed";
11
+ export type ColorDefaultKey = "currentItemStrokeColor" | "currentItemBackgroundColor" | "currentItemStickynoteStrokeColor" | "currentItemStickynoteBackgroundColor";
12
+ export type ColorTargetAppState = Pick<AppState, "selectedElementIds" | "editingTextElement" | "activeTool" | ColorDefaultKey>;
13
+ export type ColorTarget = {
14
+ kind: ColorTargetKind;
15
+ property: ColorProperty;
16
+ /** the current-item defaults a pick is written to (normalized per domain) */
17
+ appStateKeys: readonly ColorDefaultKey[];
18
+ /** the default shown when no element is targeted */
19
+ currentValue: string;
20
+ palette: ColorPaletteCustom;
21
+ topPicks: ColorTuple;
22
+ customizableTopPicks: keyof AppState["colorTopPicks"];
23
+ excludedColors: readonly string[] | undefined;
24
+ };
25
+ /**
26
+ * Who a stroke/background pick targets. Resolve it from the state an action
27
+ * runs against, at execution time — never capture it in a render closure:
28
+ * the memoized picker keeps a stale `onChange`, and the always-visible top
29
+ * picks fire it without a re-render.
30
+ *
31
+ * Targets are the selected color-capable elements (for stroke incl. bound
32
+ * labels, since a note's visible text is its label) plus the text being
33
+ * edited (`handleTextWysiwyg` deselects while editing) — or, for a
34
+ * background pick on a note's label, the note (see `getColorTargetElement`).
35
+ * With no target, the active tool decides the domain.
36
+ */
37
+ export declare const resolveColorTarget: (appState: ColorTargetAppState, elements: readonly ExcalidrawElement[], property: ColorProperty) => ColorTarget;
38
+ /** the current-item default updates for a picked color */
39
+ export declare const getColorTargetAppStateUpdates: (target: ColorTarget, color: string) => Partial<AppState>;
@@ -44,6 +44,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
44
44
  exportEmbedScene?: boolean | undefined;
45
45
  exportWithDarkMode?: boolean | undefined;
46
46
  currentItemStrokeColor?: string | undefined;
47
+ currentItemStickynoteStrokeColor?: string | undefined;
48
+ currentItemStickynoteBackgroundColor?: string | undefined;
47
49
  currentItemBackgroundColor?: string | undefined;
48
50
  currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
49
51
  currentItemStrokeWidthKey?: import("@excalidraw/common").StrokeWidthKey | undefined;
@@ -82,6 +84,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
82
84
  elementStroke: readonly string[] | null;
83
85
  elementBackground: readonly string[] | null;
84
86
  bucketFill: readonly string[] | null;
87
+ stickyNoteStroke: readonly string[] | null;
88
+ stickyNoteBackground: readonly string[] | null;
85
89
  } | undefined;
86
90
  };
87
91
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
@@ -1,15 +1,23 @@
1
+ import { LinearElementEditor } from "@excalidraw/element";
1
2
  import type { ArrowEndpoint } from "@excalidraw/element";
2
- import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted } from "@excalidraw/element/types";
3
+ import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
4
  import type App from "./App";
4
- import type { AppState } from "../types";
5
+ import type { AppState, PointerDownState } from "../types";
5
6
  /**
6
- * The text tool's interaction with arrows: the hover affordance showing where
7
- * a click would attach text to an arrow — a free endpoint (binds the arrow to
8
- * a new text element positioned against that endpoint) or the arrow's midpoint
9
- * (adds a label bound to the arrow) — and the endpoint-bound flavor of
10
- * drag-sizing a new text.
7
+ * Text ↔ arrow interactions.
11
8
  *
12
- * The scene-level logic lives in `@excalidraw/element`'s `arrowEndpointText.ts`.
9
+ * With the text tool: the hover affordance showing where a click would attach
10
+ * text to an arrow — a free endpoint (binds the arrow to a new text element
11
+ * positioned against that endpoint) or the arrow's midpoint (adds a label
12
+ * bound to the arrow) — and the endpoint-bound flavor of drag-sizing a new
13
+ * text.
14
+ *
15
+ * With the selection tool: dragging an arrow's existing label along the arrow
16
+ * — the grab affordance, the drag itself, and where a double-click starts
17
+ * editing a label the drag has moved.
18
+ *
19
+ * The scene-level logic lives in `@excalidraw/element`'s
20
+ * `arrowEndpointText.ts` and `linearElementEditor.ts`.
13
21
  */
14
22
  export declare class AppArrowText {
15
23
  private app;
@@ -69,4 +77,28 @@ export declare class AppArrowText {
69
77
  x: number;
70
78
  y: number;
71
79
  }): boolean;
80
+ /**
81
+ * Whether the arrow's label is what a grab at this position would pick up:
82
+ * the pointer is over the label, and no element stacked above the arrow
83
+ * owns the hit instead.
84
+ */
85
+ isBoundTextGrabbable(element: NonDeletedExcalidrawElement, x: number, y: number): boolean;
86
+ /**
87
+ * The pointer-move half of dragging a label along its arrow. Owns the move
88
+ * whenever the gesture started on the label (`pointerDownState.hit.arrowLabel`),
89
+ * dragging only once past the threshold. Returns whether it owned it.
90
+ */
91
+ maybeDragLabel(linearElementEditor: LinearElementEditor, pointerDownState: PointerDownState, pointerCoords: {
92
+ x: number;
93
+ y: number;
94
+ }): boolean;
95
+ /**
96
+ * Where a double-click on a labeled arrow should start text editing: the
97
+ * center of the label itself, which a label drag may have moved away from
98
+ * the arrow's midpoint. Null when the element is not a labeled arrow.
99
+ */
100
+ getLabelCenter(element: ExcalidrawElement): {
101
+ x: number;
102
+ y: number;
103
+ } | null;
72
104
  }
@@ -24,6 +24,14 @@ export declare class AppCursor {
24
24
  reset: () => void;
25
25
  /** applies the given tool's cursor (defaults to the active tool) */
26
26
  applyForTool: (activeTool?: AppState["activeTool"]) => void;
27
+ /**
28
+ * Re-runs the hover cursor logic at the last known pointer position by
29
+ * re-dispatching a synthetic pointermove — for state changes that alter
30
+ * what hovering means without the pointer moving (e.g. the tool reverting
31
+ * to selection after an element is created). Mouse only: touch and pen
32
+ * have no resting hover to restore.
33
+ */
34
+ refreshHover: () => void;
27
35
  /** clears the inline cursor so the environment default (CSS) applies */
28
36
  private clear;
29
37
  private applyEraser;
@@ -3,6 +3,7 @@ import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, ty
3
3
  import { LinearElementEditor, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
4
  import type { LocalPoint, Radians } from "@excalidraw/math";
5
5
  import type { ExcalidrawElement, ExcalidrawTextElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawTextContainer, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
6
+ import type { ArrowEndpoint, TransformHandleDirection } from "@excalidraw/element";
6
7
  import type { Mutable } from "@excalidraw/common/utility-types";
7
8
  import { ActionManager } from "../actions/manager";
8
9
  import { History } from "../history";
@@ -16,6 +17,7 @@ import { LassoTrail } from "../lasso";
16
17
  import { EraserTrail } from "../eraser";
17
18
  import { AppArrowText } from "./App.arrowText";
18
19
  import { AppBucketFill } from "./App.bucketFill";
20
+ import { AppToolDrag } from "./App.toolDrag";
19
21
  import { AppCursor } from "./App.cursor";
20
22
  import { AppDrawShape } from "./App.drawshape";
21
23
  import { AppFlowchart } from "./App.flowchart";
@@ -82,6 +84,8 @@ declare class App extends React.Component<AppProps, AppState> {
82
84
  editorInterface: EditorInterface;
83
85
  private stylesPanelMode;
84
86
  private excalidrawContainerRef;
87
+ get ownerDocument(): Document;
88
+ get ownerWindow(): Window & typeof globalThis;
85
89
  scene: Scene;
86
90
  fonts: Fonts;
87
91
  renderer: Renderer;
@@ -93,7 +97,7 @@ declare class App extends React.Component<AppProps, AppState> {
93
97
  library: AppClassProperties["library"];
94
98
  libraryItemsFromStorage: LibraryItems | undefined;
95
99
  id: string;
96
- private store;
100
+ store: Store;
97
101
  private history;
98
102
  excalidrawContainerValue: {
99
103
  container: HTMLDivElement | null;
@@ -119,6 +123,7 @@ declare class App extends React.Component<AppProps, AppState> {
119
123
  private appStateObserver;
120
124
  onStateChange: OnStateChange;
121
125
  bucketFill: AppBucketFill;
126
+ toolDrag: AppToolDrag;
122
127
  flowchart: AppFlowchart;
123
128
  cursor: AppCursor;
124
129
  arrowText: AppArrowText;
@@ -127,6 +132,13 @@ declare class App extends React.Component<AppProps, AppState> {
127
132
  private textWysiwygSubmitHandler;
128
133
  hitLinkElement?: NonDeletedExcalidrawElement;
129
134
  lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
135
+ /**
136
+ * the handle of the resize in progress while `state.isResizing` — for UI
137
+ * that words itself by handle (a sticky note's corners resize
138
+ * proportionally, its edges freely); not app state, so it costs no
139
+ * re-render of its own
140
+ */
141
+ activeResizeHandle: TransformHandleDirection | null;
130
142
  lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
131
143
  lastPointerUpIsDoubleClick: boolean;
132
144
  lastPointerMoveEvent: PointerEvent | null;
@@ -185,6 +197,7 @@ declare class App extends React.Component<AppProps, AppState> {
185
197
  wasAddedToSelection: boolean;
186
198
  hasBeenDuplicated: boolean;
187
199
  hasHitCommonBoundingBoxOfSelectedElements: boolean;
200
+ arrowLabel: boolean;
188
201
  };
189
202
  withCmdOrCtrl: boolean;
190
203
  drag: {
@@ -247,6 +260,7 @@ declare class App extends React.Component<AppProps, AppState> {
247
260
  wasAddedToSelection: boolean;
248
261
  hasBeenDuplicated: boolean;
249
262
  hasHitCommonBoundingBoxOfSelectedElements: boolean;
263
+ arrowLabel: boolean;
250
264
  };
251
265
  withCmdOrCtrl: boolean;
252
266
  drag: {
@@ -363,6 +377,11 @@ declare class App extends React.Component<AppProps, AppState> {
363
377
  getEffectiveGridSize: () => NullableGridSize;
364
378
  private getTextCreationGridPoint;
365
379
  private getHTMLIFrameElement;
380
+ /**
381
+ * AI-generated iframe elements aren't interactive while their generation
382
+ * is still in progress (the partial content is render-only).
383
+ */
384
+ private isIframeLikeInteractive;
366
385
  private handleIframeLikeElementHover;
367
386
  /** @returns true if iframe-like element click handled */
368
387
  private handleIframeLikeCenterClick;
@@ -571,9 +590,12 @@ declare class App extends React.Component<AppProps, AppState> {
571
590
  }) & {
572
591
  preferSelected?: boolean;
573
592
  }): NonDeleted<ExcalidrawElement> | null;
574
- private getElementsAtPosition;
593
+ getElementsAtPosition(x: number, y: number, opts?: {
594
+ includeBoundTextElement?: boolean;
595
+ includeLockedElements?: boolean;
596
+ }): NonDeleted<ExcalidrawElement>[];
575
597
  getElementHitThreshold(element: ExcalidrawElement): number;
576
- private hitElement;
598
+ hitElement(x: number, y: number, element: NonDeletedExcalidrawElement, considerBoundingBox?: boolean): boolean;
577
599
  getTextBindableContainerAtPosition(x: number, y: number): (Readonly<{
578
600
  id: string;
579
601
  x: number;
@@ -601,6 +623,7 @@ declare class App extends React.Component<AppProps, AppState> {
601
623
  frameId: string | null;
602
624
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
603
625
  updated: number;
626
+ created: number | null;
604
627
  link: string | null;
605
628
  locked: boolean;
606
629
  customData?: Record<string, any>;
@@ -635,6 +658,43 @@ declare class App extends React.Component<AppProps, AppState> {
635
658
  frameId: string | null;
636
659
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
637
660
  updated: number;
661
+ created: number | null;
662
+ link: string | null;
663
+ locked: boolean;
664
+ customData?: Record<string, any>;
665
+ }> & Readonly<{
666
+ type: "stickynote";
667
+ baseHeight: number;
668
+ }> & {
669
+ isDeleted: false;
670
+ }) | (Readonly<{
671
+ id: string;
672
+ x: number;
673
+ y: number;
674
+ strokeColor: string;
675
+ backgroundColor: string;
676
+ fillStyle: import("@excalidraw/element/types").FillStyle;
677
+ strokeWidth: number;
678
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
679
+ roundness: null | {
680
+ type: import("@excalidraw/element/types").RoundnessType;
681
+ value?: number;
682
+ };
683
+ roughness: number;
684
+ opacity: number;
685
+ width: number;
686
+ height: number;
687
+ angle: Radians;
688
+ seed: number;
689
+ version: number;
690
+ versionNonce: number;
691
+ index: import("@excalidraw/element/types").FractionalIndex | null;
692
+ isDeleted: boolean;
693
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
694
+ frameId: string | null;
695
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
696
+ updated: number;
697
+ created: number | null;
638
698
  link: string | null;
639
699
  locked: boolean;
640
700
  customData?: Record<string, any>;
@@ -669,6 +729,7 @@ declare class App extends React.Component<AppProps, AppState> {
669
729
  frameId: string | null;
670
730
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
671
731
  updated: number;
732
+ created: number | null;
672
733
  link: string | null;
673
734
  locked: boolean;
674
735
  customData?: Record<string, any>;
@@ -703,6 +764,7 @@ declare class App extends React.Component<AppProps, AppState> {
703
764
  frameId: string | null;
704
765
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
705
766
  updated: number;
767
+ created: number | null;
706
768
  link: string | null;
707
769
  locked: boolean;
708
770
  customData?: Record<string, any>;
@@ -731,7 +793,25 @@ declare class App extends React.Component<AppProps, AppState> {
731
793
  * so the whole create-and-type lands in a single entry.
732
794
  */
733
795
  private isEditingTextContent;
734
- private startTextEditing;
796
+ startTextEditing: ({ sceneX, sceneY, insertAtParentCenter, container, autoEdit, initialCaretSceneCoords, arrowEndpoint, }: {
797
+ /** X position to insert text at */
798
+ sceneX: number;
799
+ /** Y position to insert text at */
800
+ sceneY: number;
801
+ /** whether to attempt to insert at element center if applicable */
802
+ insertAtParentCenter?: boolean;
803
+ container?: ExcalidrawTextContainer | null;
804
+ autoEdit?: boolean;
805
+ initialCaretSceneCoords?: {
806
+ x: number;
807
+ y: number;
808
+ };
809
+ /**
810
+ * creates the text as a label for this arrow endpoint: the binding then
811
+ * dictates the text's position and alignment, overriding (sceneX, sceneY)
812
+ */
813
+ arrowEndpoint?: ArrowEndpoint | null;
814
+ }) => void;
735
815
  private startImageCropping;
736
816
  private finishImageCropping;
737
817
  private shouldHandleBrowserCanvasDoubleClick;
@@ -784,6 +864,10 @@ declare class App extends React.Component<AppProps, AppState> {
784
864
  private handleCanvasPointerMove;
785
865
  private handleEraser;
786
866
  private handleTouchMove;
867
+ /**
868
+ * Applies the hover affordances of a selected linear element: the cursor,
869
+ * plus the hovered-handle state that renders them highlighted.
870
+ */
787
871
  handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
788
872
  private handleCanvasPointerDown;
789
873
  private handleCanvasPointerUp;
@@ -826,8 +910,10 @@ declare class App extends React.Component<AppProps, AppState> {
826
910
  }) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
827
911
  private newImagePlaceholder;
828
912
  private handleLinearElementOnPointerDown;
829
- private getCurrentItemRoundness;
830
- private getCurrentItemStrokeWidth;
913
+ getCurrentItemRoundness(elementType: "selection" | "rectangle" | "stickynote" | "diamond" | "ellipse" | "iframe" | "embeddable"): {
914
+ type: 2 | 3;
915
+ } | null;
916
+ getCurrentItemStrokeWidth(elementType: ExcalidrawElement["type"]): number;
831
917
  private createGenericElementOnPointerDown;
832
918
  private createFrameElementOnPointerDown;
833
919
  private maybeCacheReferenceSnapPoints;