@excalidraw/element 0.18.0-4872083 → 0.18.0-4ce38fb

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 (119) hide show
  1. package/dist/dev/index.js +5645 -3994
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +16 -15
  4. package/dist/types/common/src/colors.d.ts +13 -7
  5. package/dist/types/common/src/constants.d.ts +54 -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/common/src/utils.d.ts +5 -0
  9. package/dist/types/element/src/Scene.d.ts +1 -1
  10. package/dist/types/element/src/binding.d.ts +13 -7
  11. package/dist/types/element/src/collision.d.ts +14 -5
  12. package/dist/types/element/src/comparisons.d.ts +5 -3
  13. package/dist/types/element/src/delta.d.ts +23 -1
  14. package/dist/types/element/src/duplicate.d.ts +60 -0
  15. package/dist/types/element/src/flowchart.d.ts +5 -1
  16. package/dist/types/element/src/frame.d.ts +2 -2
  17. package/dist/types/element/src/index.d.ts +2 -0
  18. package/dist/types/element/src/linearElementEditor.d.ts +10 -0
  19. package/dist/types/element/src/listMarker.d.ts +34 -0
  20. package/dist/types/element/src/mutateElement.d.ts +1 -1
  21. package/dist/types/element/src/newElement.d.ts +39 -3
  22. package/dist/types/element/src/renderElement.d.ts +21 -4
  23. package/dist/types/element/src/shape.d.ts +15 -1
  24. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  25. package/dist/types/element/src/stickyNote.d.ts +183 -0
  26. package/dist/types/element/src/textElement.d.ts +9 -1
  27. package/dist/types/element/src/transform.d.ts +25 -6
  28. package/dist/types/element/src/typeChecks.d.ts +3 -2
  29. package/dist/types/element/src/types.d.ts +35 -6
  30. package/dist/types/element/src/utils.d.ts +15 -4
  31. package/dist/types/element/src/zindex.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +60 -3
  33. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  34. package/dist/types/excalidraw/actions/actionBoundText.d.ts +40 -2
  35. package/dist/types/excalidraw/actions/actionCanvas.d.ts +140 -7
  36. package/dist/types/excalidraw/actions/actionClipboard.d.ts +40 -2
  37. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +20 -1
  38. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +61 -4
  39. package/dist/types/excalidraw/actions/actionDeselect.d.ts +23 -1
  40. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  41. package/dist/types/excalidraw/actions/actionElementLink.d.ts +20 -1
  42. package/dist/types/excalidraw/actions/actionElementLock.d.ts +40 -2
  43. package/dist/types/excalidraw/actions/actionExport.d.ts +40 -2
  44. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  45. package/dist/types/excalidraw/actions/actionFrame.d.ts +111 -4
  46. package/dist/types/excalidraw/actions/actionGroup.d.ts +40 -2
  47. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +71 -2
  48. package/dist/types/excalidraw/actions/actionLink.d.ts +20 -1
  49. package/dist/types/excalidraw/actions/actionMenu.d.ts +20 -1
  50. package/dist/types/excalidraw/actions/actionProperties.d.ts +50 -8
  51. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +20 -1
  52. package/dist/types/excalidraw/actions/actionStyles.d.ts +21 -2
  53. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +20 -1
  54. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +20 -1
  55. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +20 -1
  56. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +20 -1
  57. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +20 -1
  58. package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +197 -0
  59. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +20 -1
  60. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +20 -1
  61. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +20 -1
  62. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  63. package/dist/types/excalidraw/actions/index.d.ts +1 -0
  64. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  65. package/dist/types/excalidraw/appState.d.ts +23 -1
  66. package/dist/types/excalidraw/components/App.arrowText.d.ts +28 -30
  67. package/dist/types/excalidraw/components/App.bucketFill.d.ts +10 -0
  68. package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
  69. package/dist/types/excalidraw/components/App.cursor.d.ts +8 -0
  70. package/dist/types/excalidraw/components/App.d.ts +110 -199
  71. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  72. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  73. package/dist/types/excalidraw/components/App.text.d.ts +146 -0
  74. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  75. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  76. package/dist/types/excalidraw/components/App.viewport.d.ts +41 -1
  77. package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
  78. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +6 -2
  79. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  80. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -1
  81. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +4 -2
  82. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  83. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  84. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  85. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  86. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  87. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  88. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  89. package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
  90. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  91. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  92. package/dist/types/excalidraw/components/Tools.d.ts +7 -2
  93. package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
  94. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  95. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  96. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  97. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  98. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  99. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
  100. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
  101. package/dist/types/excalidraw/data/blob.d.ts +40 -2
  102. package/dist/types/excalidraw/data/json.d.ts +20 -1
  103. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  104. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  105. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  106. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  107. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  108. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  109. package/dist/types/excalidraw/scene/Renderer.d.ts +64 -2
  110. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  111. package/dist/types/excalidraw/scene/types.d.ts +3 -1
  112. package/dist/types/excalidraw/types.d.ts +140 -18
  113. package/dist/types/excalidraw/viewport.d.ts +33 -1
  114. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
  115. package/dist/types/math/src/curve.d.ts +19 -12
  116. package/dist/types/math/src/segment.d.ts +6 -0
  117. package/dist/types/utils/src/export.d.ts +1 -0
  118. package/dist/types/utils/src/shape.d.ts +2 -2
  119. package/package.json +4 -4
@@ -0,0 +1,197 @@
1
+ export declare const actionToggleShowHints: {
2
+ name: "showHints";
3
+ label: string;
4
+ icon: import("react/jsx-runtime").JSX.Element;
5
+ keywords: string[];
6
+ viewMode: false;
7
+ trackEvent: {
8
+ category: "canvas";
9
+ predicate: (appState: Readonly<import("../types").AppState>) => boolean;
10
+ };
11
+ perform(elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>): {
12
+ appState: {
13
+ showHints: boolean;
14
+ contextMenu: {
15
+ items: import("../components/ContextMenu").ContextMenuItems;
16
+ top: number;
17
+ left: number;
18
+ } | null;
19
+ showWelcomeScreen: boolean;
20
+ isLoading: boolean;
21
+ errorMessage: React.ReactNode;
22
+ activeEmbeddable: {
23
+ element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
24
+ state: "hover" | "active";
25
+ } | null;
26
+ newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
27
+ resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
28
+ multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
29
+ selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
30
+ isBindingEnabled: boolean;
31
+ boxSelectionMode: import("../types").BoxSelectionMode;
32
+ bindingPreference: "enabled" | "disabled";
33
+ isMidpointSnappingEnabled: boolean;
34
+ inputDevice: import("../types").InputDevice;
35
+ suggestedBinding: {
36
+ element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
37
+ midPoint?: import("@excalidraw/math").GlobalPoint;
38
+ } | null;
39
+ textToolHover: {
40
+ type: "text";
41
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
42
+ } | {
43
+ type: "container";
44
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
45
+ } | {
46
+ type: "arrow";
47
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
48
+ anchor: "start" | "end" | "label";
49
+ } | null;
50
+ frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
51
+ frameRendering: {
52
+ enabled: boolean;
53
+ name: boolean;
54
+ outline: boolean;
55
+ clip: boolean;
56
+ };
57
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
58
+ elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
59
+ editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
60
+ activeTool: {
61
+ lastActiveTool: import("../types").ActiveTool | null;
62
+ locked: boolean;
63
+ fromSelection: boolean;
64
+ } & import("../types").ActiveTool;
65
+ preferredSelectionTool: {
66
+ type: "selection" | "lasso";
67
+ initialized: boolean;
68
+ };
69
+ penMode: boolean;
70
+ penDetected: boolean;
71
+ exportBackground: boolean;
72
+ exportEmbedScene: boolean;
73
+ exportWithDarkMode: boolean;
74
+ exportScale: number;
75
+ currentItemStrokeColor: string;
76
+ currentItemStickynoteStrokeColor: string;
77
+ currentItemStickynoteBackgroundColor: string;
78
+ currentItemBackgroundColor: string;
79
+ currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
80
+ currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
81
+ currentItemStrokeStyle: import("@excalidraw/element/types").ExcalidrawElement["strokeStyle"];
82
+ currentItemRoughness: number;
83
+ currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
84
+ currentItemOpacity: number;
85
+ currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
86
+ currentItemFontSize: number;
87
+ currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
88
+ currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
89
+ currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
90
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
91
+ currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
92
+ currentItemArrowType: "sharp" | "round" | "elbow";
93
+ viewBackgroundColor: string;
94
+ scrollX: number;
95
+ scrollY: number;
96
+ scrollConstraints: import("../types").ScrollConstraints | null;
97
+ cursorButton: "up" | "down";
98
+ scrolledOutside: boolean;
99
+ name: string | null;
100
+ isResizing: boolean;
101
+ isRotating: boolean;
102
+ zoom: import("../types").Zoom;
103
+ openMenu: "canvas" | null;
104
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
105
+ openSidebar: {
106
+ name: import("../types").SidebarName;
107
+ tab?: import("../types").SidebarTabName;
108
+ } | null;
109
+ openDialog: null | {
110
+ name: "imageExport" | "help" | "jsonExport";
111
+ } | {
112
+ name: "ttd";
113
+ tab: "text-to-diagram" | "mermaid";
114
+ } | {
115
+ name: "commandPalette";
116
+ } | {
117
+ name: "settings";
118
+ } | {
119
+ name: "elementLinkSelector";
120
+ sourceElementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
121
+ } | {
122
+ name: "charts";
123
+ data: import("../charts").Spreadsheet;
124
+ rawText: string;
125
+ };
126
+ defaultSidebarDockedPreference: boolean;
127
+ lastPointerDownWith: import("@excalidraw/element/types").PointerType;
128
+ selectedElementIds: Readonly<{
129
+ [id: string]: true;
130
+ }>;
131
+ hoveredElementIds: Readonly<{
132
+ [id: string]: true;
133
+ }>;
134
+ previousSelectedElementIds: {
135
+ [id: string]: true;
136
+ };
137
+ selectedElementsAreBeingDragged: boolean;
138
+ shouldCacheIgnoreZoom: boolean;
139
+ toast: {
140
+ message: React.ReactNode;
141
+ closable?: boolean;
142
+ duration?: number;
143
+ } | null;
144
+ zenModeEnabled: boolean;
145
+ theme: import("@excalidraw/element/types").Theme;
146
+ gridSize: number;
147
+ gridStep: number;
148
+ gridModeEnabled: boolean;
149
+ viewModeEnabled: boolean;
150
+ selectedGroupIds: {
151
+ [groupId: string]: boolean;
152
+ };
153
+ editingGroupId: import("@excalidraw/element/types").GroupId | null;
154
+ width: number;
155
+ height: number;
156
+ offsetTop: number;
157
+ offsetLeft: number;
158
+ fileHandle: FileSystemFileHandle | null;
159
+ collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
160
+ stats: {
161
+ open: boolean;
162
+ panels: number;
163
+ };
164
+ showHyperlinkPopup: false | "info" | "editor";
165
+ selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
166
+ snapLines: readonly import("../snapping").SnapLine[];
167
+ originSnapOffset: {
168
+ x: number;
169
+ y: number;
170
+ } | null;
171
+ objectsSnapModeEnabled: boolean;
172
+ isCropping: boolean;
173
+ croppingElementId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
174
+ searchMatches: Readonly<{
175
+ focusedId: import("@excalidraw/element/types").ExcalidrawElement["id"] | null;
176
+ matches: readonly import("../types").SearchMatch[];
177
+ }> | null;
178
+ activeLockedId: string | null;
179
+ lockedMultiSelections: {
180
+ [groupId: string]: true;
181
+ };
182
+ bindMode: import("@excalidraw/element/types").BindMode;
183
+ colorTopPicks: {
184
+ elementStroke: readonly string[] | null;
185
+ elementBackground: readonly string[] | null;
186
+ bucketFill: readonly string[] | null;
187
+ stickyNoteStroke: readonly string[] | null;
188
+ stickyNoteBackground: readonly string[] | null;
189
+ };
190
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
191
+ };
192
+ captureUpdate: "NEVER";
193
+ };
194
+ checked: (appState: Readonly<import("../types").UIAppState>) => boolean;
195
+ } & {
196
+ keyTest?: undefined;
197
+ };
@@ -33,11 +33,20 @@ export declare const actionToggleStats: {
33
33
  boxSelectionMode: import("../types").BoxSelectionMode;
34
34
  bindingPreference: "enabled" | "disabled";
35
35
  isMidpointSnappingEnabled: boolean;
36
+ showHints: boolean;
37
+ inputDevice: import("../types").InputDevice;
36
38
  suggestedBinding: {
37
39
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
38
40
  midPoint?: import("@excalidraw/math").GlobalPoint;
39
41
  } | null;
40
- hoveredArrowTextAnchor: {
42
+ textToolHover: {
43
+ type: "text";
44
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
45
+ } | {
46
+ type: "container";
47
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
48
+ } | {
49
+ type: "arrow";
41
50
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
42
51
  anchor: "start" | "end" | "label";
43
52
  } | null;
@@ -67,6 +76,8 @@ export declare const actionToggleStats: {
67
76
  exportWithDarkMode: boolean;
68
77
  exportScale: number;
69
78
  currentItemStrokeColor: string;
79
+ currentItemStickynoteStrokeColor: string;
80
+ currentItemStickynoteBackgroundColor: string;
70
81
  currentItemBackgroundColor: string;
71
82
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
72
83
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -168,6 +179,14 @@ export declare const actionToggleStats: {
168
179
  [groupId: string]: true;
169
180
  };
170
181
  bindMode: import("@excalidraw/element/types").BindMode;
182
+ colorTopPicks: {
183
+ elementStroke: readonly string[] | null;
184
+ elementBackground: readonly string[] | null;
185
+ bucketFill: readonly string[] | null;
186
+ stickyNoteStroke: readonly string[] | null;
187
+ stickyNoteBackground: readonly string[] | null;
188
+ };
189
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
171
190
  };
172
191
  captureUpdate: "EVENTUALLY";
173
192
  };
@@ -30,11 +30,20 @@ export declare const actionToggleViewMode: {
30
30
  boxSelectionMode: import("../types").BoxSelectionMode;
31
31
  bindingPreference: "enabled" | "disabled";
32
32
  isMidpointSnappingEnabled: boolean;
33
+ showHints: boolean;
34
+ inputDevice: import("../types").InputDevice;
33
35
  suggestedBinding: {
34
36
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
35
37
  midPoint?: import("@excalidraw/math").GlobalPoint;
36
38
  } | null;
37
- hoveredArrowTextAnchor: {
39
+ textToolHover: {
40
+ type: "text";
41
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
42
+ } | {
43
+ type: "container";
44
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
45
+ } | {
46
+ type: "arrow";
38
47
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
39
48
  anchor: "start" | "end" | "label";
40
49
  } | null;
@@ -64,6 +73,8 @@ export declare const actionToggleViewMode: {
64
73
  exportWithDarkMode: boolean;
65
74
  exportScale: number;
66
75
  currentItemStrokeColor: string;
76
+ currentItemStickynoteStrokeColor: string;
77
+ currentItemStickynoteBackgroundColor: string;
67
78
  currentItemBackgroundColor: string;
68
79
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
69
80
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -168,6 +179,14 @@ export declare const actionToggleViewMode: {
168
179
  [groupId: string]: true;
169
180
  };
170
181
  bindMode: import("@excalidraw/element/types").BindMode;
182
+ colorTopPicks: {
183
+ elementStroke: readonly string[] | null;
184
+ elementBackground: readonly string[] | null;
185
+ bucketFill: readonly string[] | null;
186
+ stickyNoteStroke: readonly string[] | null;
187
+ stickyNoteBackground: readonly string[] | null;
188
+ };
189
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
171
190
  };
172
191
  captureUpdate: "EVENTUALLY";
173
192
  };
@@ -30,11 +30,20 @@ export declare const actionToggleZenMode: {
30
30
  boxSelectionMode: import("../types").BoxSelectionMode;
31
31
  bindingPreference: "enabled" | "disabled";
32
32
  isMidpointSnappingEnabled: boolean;
33
+ showHints: boolean;
34
+ inputDevice: import("../types").InputDevice;
33
35
  suggestedBinding: {
34
36
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
35
37
  midPoint?: import("@excalidraw/math").GlobalPoint;
36
38
  } | null;
37
- hoveredArrowTextAnchor: {
39
+ textToolHover: {
40
+ type: "text";
41
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
42
+ } | {
43
+ type: "container";
44
+ elementId: import("@excalidraw/element/types").ExcalidrawElement["id"];
45
+ } | {
46
+ type: "arrow";
38
47
  elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
39
48
  anchor: "start" | "end" | "label";
40
49
  } | null;
@@ -64,6 +73,8 @@ export declare const actionToggleZenMode: {
64
73
  exportWithDarkMode: boolean;
65
74
  exportScale: number;
66
75
  currentItemStrokeColor: string;
76
+ currentItemStickynoteStrokeColor: string;
77
+ currentItemStickynoteBackgroundColor: string;
67
78
  currentItemBackgroundColor: string;
68
79
  currentItemFillStyle: import("@excalidraw/element/types").ExcalidrawElement["fillStyle"];
69
80
  currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
@@ -168,6 +179,14 @@ export declare const actionToggleZenMode: {
168
179
  [groupId: string]: true;
169
180
  };
170
181
  bindMode: import("@excalidraw/element/types").BindMode;
182
+ colorTopPicks: {
183
+ elementStroke: readonly string[] | null;
184
+ elementBackground: readonly string[] | null;
185
+ bucketFill: readonly string[] | null;
186
+ stickyNoteStroke: readonly string[] | null;
187
+ stickyNoteBackground: readonly string[] | null;
188
+ };
189
+ fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
171
190
  };
172
191
  captureUpdate: "EVENTUALLY";
173
192
  };
@@ -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>;
@@ -21,6 +21,7 @@ export { actionToggleZenMode } from "./actionToggleZenMode";
21
21
  export { actionToggleObjectsSnapMode } from "./actionToggleObjectsSnapMode";
22
22
  export { actionToggleArrowBinding } from "./actionToggleArrowBinding";
23
23
  export { actionToggleMidpointSnapping } from "./actionToggleMidpointSnapping";
24
+ export { actionToggleShowHints } from "./actionToggleShowHints";
24
25
  export { actionToggleStats } from "./actionToggleStats";
25
26
  export { actionUnbindText, actionBindText } from "./actionBoundText";
26
27
  export { actionLink } from "./actionLink";
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export type UpdaterFn = (res: ActionResult) => void;
16
16
  export type ActionFilterFn = (action: Action) => void;
17
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleShapeSwitch" | "togglePolygon";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "showHints" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleShapeSwitch" | "togglePolygon";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: UIAppState;
@@ -1,4 +1,4 @@
1
- import type { AppState, NormalizedZoomValue } from "./types";
1
+ import type { AppState, InputDevice, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
4
  viewBackgroundColor?: string | undefined;
@@ -34,6 +34,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
34
34
  showWelcomeScreen?: boolean | undefined;
35
35
  boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
36
36
  bindingPreference?: "enabled" | "disabled" | undefined;
37
+ showHints?: boolean | undefined;
38
+ inputDevice?: InputDevice | undefined;
37
39
  preferredSelectionTool?: {
38
40
  type: "selection" | "lasso";
39
41
  initialized: boolean;
@@ -44,6 +46,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
44
46
  exportEmbedScene?: boolean | undefined;
45
47
  exportWithDarkMode?: boolean | undefined;
46
48
  currentItemStrokeColor?: string | undefined;
49
+ currentItemStickynoteStrokeColor?: string | undefined;
50
+ currentItemStickynoteBackgroundColor?: string | undefined;
47
51
  currentItemBackgroundColor?: string | undefined;
48
52
  currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
49
53
  currentItemStrokeWidthKey?: import("@excalidraw/common").StrokeWidthKey | undefined;
@@ -78,6 +82,14 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
78
82
  lockedMultiSelections?: {
79
83
  [groupId: string]: true;
80
84
  } | undefined;
85
+ colorTopPicks?: {
86
+ elementStroke: readonly string[] | null;
87
+ elementBackground: readonly string[] | null;
88
+ bucketFill: readonly string[] | null;
89
+ stickyNoteStroke: readonly string[] | null;
90
+ stickyNoteBackground: readonly string[] | null;
91
+ } | undefined;
92
+ fontTopPicks?: readonly number[] | null | undefined;
81
93
  };
82
94
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
83
95
  viewBackgroundColor?: string | undefined;
@@ -103,3 +115,13 @@ export declare const isEraserActive: ({ activeTool, }: {
103
115
  export declare const isHandToolActive: ({ activeTool, }: {
104
116
  activeTool: AppState["activeTool"];
105
117
  }) => boolean;
118
+ /**
119
+ * The device the wheel mappings follow for the given preference.
120
+ *
121
+ * `auto` is meant to detect the device from the wheel events themselves
122
+ * (line vs. pixel delta modes, whole vs. fractional deltas, one vs. two axes
123
+ * moving, event cadence and momentum tails). That is not implemented yet, so
124
+ * it resolves to `trackpad` — the mapping the editor has always had, and the
125
+ * default to keep until detection exists.
126
+ */
127
+ export declare const resolveInputDevice: (inputDevice: InputDevice) => Exclude<InputDevice, "auto">;
@@ -1,47 +1,30 @@
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 { 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 free endpoint a click would bind a new text to
10
+ * (`AppTextTool` resolves and shows it), the binding itself, and the
11
+ * endpoint-bound flavor of drag-sizing a new text.
12
+ *
13
+ * With the selection tool: dragging an arrow's existing label along the arrow
14
+ * — the grab affordance and the drag itself.
15
+ *
16
+ * The scene-level logic lives in `@excalidraw/element`'s
17
+ * `arrowEndpointText.ts` and `linearElementEditor.ts`.
13
18
  */
14
19
  export declare class AppArrowText {
15
20
  private app;
16
21
  constructor(app: App);
17
- /**
18
- * With the text tool active, an arrow under the cursor is a target for
19
- * attaching text. Returns where the text would land (if anywhere), and keeps
20
- * `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
21
- */
22
- updateHoveredAnchor: (scenePointer: {
23
- x: number;
24
- y: number;
25
- }) => AppState["hoveredArrowTextAnchor"];
26
- /**
27
- * Re-evaluates the hovered anchor at the last known pointer position — for
28
- * events that change what a click would do without the pointer moving,
29
- * i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
30
- * wholesale — tool switches, finalize, deselect — clear it directly
31
- * instead.)
32
- */
33
- refresh: () => void;
34
22
  /**
35
23
  * A free arrow endpoint a new text could be bound to. Binding an endpoint is
36
24
  * an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
37
25
  * other one — holding it makes the text tool drop plain text instead.
38
26
  */
39
27
  getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
40
- /**
41
- * Mirrors what `handleTextOnPointerDown` would do at this position, so the
42
- * highlight can't promise something the click won't deliver.
43
- */
44
- private getAnchorAtPosition;
45
28
  /**
46
29
  * How a text should be created to read as a label for this endpoint — the
47
30
  * side midpoint to bind, the alignment that pins it, and the scene position
@@ -69,4 +52,19 @@ export declare class AppArrowText {
69
52
  x: number;
70
53
  y: number;
71
54
  }): boolean;
55
+ /**
56
+ * Whether the arrow's label is what a grab at this position would pick up:
57
+ * the pointer is over the label, and no element stacked above the arrow
58
+ * owns the hit instead.
59
+ */
60
+ isBoundTextGrabbable(element: NonDeletedExcalidrawElement, x: number, y: number): boolean;
61
+ /**
62
+ * The pointer-move half of dragging a label along its arrow. Owns the move
63
+ * whenever the gesture started on the label (`pointerDownState.hit.arrowLabel`),
64
+ * dragging only once past the threshold. Returns whether it owned it.
65
+ */
66
+ maybeDragLabel(linearElementEditor: LinearElementEditor, pointerDownState: PointerDownState, pointerCoords: {
67
+ x: number;
68
+ y: number;
69
+ }): boolean;
72
70
  }
@@ -1,3 +1,4 @@
1
+ import type { Theme } from "@excalidraw/element/types";
1
2
  import type App from "./App";
2
3
  type ScenePoint = {
3
4
  x: number;
@@ -34,5 +35,14 @@ export declare class AppBucketFill {
34
35
  */
35
36
  private restyle;
36
37
  private fill;
38
+ /**
39
+ * The color the bucket fill tool actually fills with: the shared
40
+ * `currentItemBackgroundColor`, falling back to green when that is
41
+ * transparent (the tool's picker doesn't offer transparent, but the shared
42
+ * state can hold it from the generic shape picker).
43
+ */
44
+ getBucketFillBackgroundColor: (backgroundColor: string,
45
+ /** supply only for display purposes such as when applying to the cursor */
46
+ theme?: Theme) => string;
37
47
  }
38
48
  export {};
@@ -0,0 +1,31 @@
1
+ import type React from "react";
2
+ import type App from "./App";
3
+ type AppClipboardDependencies = {
4
+ getContainer: () => HTMLDivElement | null;
5
+ };
6
+ /**
7
+ * The clipboard: cut and copy (through their actions), and paste — the
8
+ * pasted data parsed (`pasteFromClipboard`) and inserted as whatever it is
9
+ * (`insertClipboardContent`): images or SVG code, elements, a Mermaid
10
+ * definition, embeddable URLs, a spreadsheet (as a chart), mixed content,
11
+ * or text. Pasted elements go in through `app.addElementsFromPasteOrLibrary`,
12
+ * as a library item or a drop does.
13
+ */
14
+ export declare class AppClipboard {
15
+ private app;
16
+ private dependencies;
17
+ constructor(app: App, dependencies: AppClipboardDependencies);
18
+ onCut: (event: ClipboardEvent) => void;
19
+ onCopy: (event: ClipboardEvent) => void;
20
+ private insertClipboardContent;
21
+ /**
22
+ * Ctrl/Cmd+V: whether the paste event that follows is a plain one (with
23
+ * Shift)
24
+ */
25
+ onPasteShortcut: (event: React.KeyboardEvent | KeyboardEvent) => void;
26
+ clearPlainPaste: () => void;
27
+ pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
28
+ private addElementsFromMixedContentPaste;
29
+ private addTextFromPaste;
30
+ }
31
+ export {};
@@ -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;