@myoc/excalidraw 0.19.503 → 0.19.504

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 (49) hide show
  1. package/CHANGELOG.md +70 -13
  2. package/dist/dev/{chunk-YVUPBWS6.js → chunk-Z5DMFRJ5.js} +4 -4
  3. package/dist/dev/{chunk-YVUPBWS6.js.map → chunk-Z5DMFRJ5.js.map} +1 -1
  4. package/dist/dev/data/{image-I24D3FB6.js → image-ZR5DXOGS.js} +2 -2
  5. package/dist/dev/index.css.map +2 -2
  6. package/dist/dev/index.js +334 -372
  7. package/dist/dev/index.js.map +4 -4
  8. package/dist/prod/{chunk-2VV6LBBJ.js → chunk-44LLHLSZ.js} +2 -2
  9. package/dist/prod/data/{image-IFJHSHJP.js → image-XPYUWCHN.js} +1 -1
  10. package/dist/prod/index.js +19 -19
  11. package/dist/types/element/src/arrange-algorithms/maxRects.d.ts +16 -0
  12. package/dist/types/element/src/linearElementEditor.d.ts +1 -1
  13. package/dist/types/element/src/types.d.ts +1 -1
  14. package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
  15. package/dist/types/excalidraw/actions/actionArrange.d.ts +2 -2
  16. package/dist/types/excalidraw/actions/actionCanvas.d.ts +16 -16
  17. package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -2
  18. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +2 -2
  19. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
  20. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  21. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  22. package/dist/types/excalidraw/actions/actionExport.d.ts +12 -12
  23. package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
  24. package/dist/types/excalidraw/actions/actionFrame.d.ts +2 -2
  25. package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -4
  26. package/dist/types/excalidraw/actions/actionLink.d.ts +2 -2
  27. package/dist/types/excalidraw/actions/actionMenu.d.ts +2 -2
  28. package/dist/types/excalidraw/actions/actionProperties.d.ts +5 -5
  29. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +3 -3
  30. package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +2 -2
  31. package/dist/types/excalidraw/actions/actionStyles.d.ts +4 -4
  32. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -1
  33. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -2
  34. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -2
  36. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  37. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -2
  38. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -2
  39. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  40. package/dist/types/excalidraw/appState.d.ts +7 -7
  41. package/dist/types/excalidraw/components/App.d.ts +2 -1
  42. package/dist/types/excalidraw/components/shapes.d.ts +263 -0
  43. package/dist/types/excalidraw/data/blob.d.ts +12 -12
  44. package/dist/types/excalidraw/data/json.d.ts +6 -6
  45. package/dist/types/excalidraw/editorPreferences.d.ts +11 -0
  46. package/dist/types/excalidraw/index.d.ts +1 -0
  47. package/dist/types/excalidraw/types.d.ts +21 -0
  48. package/package.json +4 -4
  49. /package/dist/dev/data/{image-I24D3FB6.js.map → image-ZR5DXOGS.js.map} +0 -0
@@ -12,10 +12,10 @@ export declare const actionSendBackward: {
12
12
  captureUpdate: "IMMEDIATELY";
13
13
  };
14
14
  keyPriority: number;
15
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
15
+ keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
16
16
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
17
17
  } & {
18
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
18
+ keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
19
19
  };
20
20
  export declare const actionBringForward: {
21
21
  name: "bringForward";
@@ -31,10 +31,10 @@ export declare const actionBringForward: {
31
31
  captureUpdate: "IMMEDIATELY";
32
32
  };
33
33
  keyPriority: number;
34
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
34
+ keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
35
35
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
36
36
  } & {
37
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
37
+ keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
38
38
  };
39
39
  export declare const actionSendToBack: {
40
40
  name: "sendToBack";
@@ -49,10 +49,10 @@ export declare const actionSendToBack: {
49
49
  appState: Readonly<import("../types").AppState>;
50
50
  captureUpdate: "IMMEDIATELY";
51
51
  };
52
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
52
+ keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
53
53
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
54
54
  } & {
55
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
55
+ keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
56
56
  };
57
57
  export declare const actionBringToFront: {
58
58
  name: "bringToFront";
@@ -67,8 +67,8 @@ export declare const actionBringToFront: {
67
67
  appState: Readonly<import("../types").AppState>;
68
68
  captureUpdate: "IMMEDIATELY";
69
69
  };
70
- keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
70
+ keyTest: (event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean;
71
71
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
72
72
  } & {
73
- keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
73
+ keyTest?: ((event: import("react").KeyboardEvent<Element> | KeyboardEvent) => boolean) | undefined;
74
74
  };
@@ -30,11 +30,14 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
30
30
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
31
31
  bindMode?: import("@excalidraw/element/types").BindMode | undefined;
32
32
  gridSize?: number | undefined;
33
+ gridModeEnabled?: boolean | undefined;
34
+ objectsSnapModeEnabled?: boolean | undefined;
35
+ wheelZoomsOnDefault?: boolean | undefined;
36
+ gridStep?: number | undefined;
33
37
  showWelcomeScreen?: boolean | undefined;
34
38
  myocSimplifiedMode?: boolean | undefined;
35
39
  dontResizeLimitMBs?: number | undefined;
36
40
  hideMainMenus?: boolean | undefined;
37
- wheelZoomsOnDefault?: boolean | undefined;
38
41
  arrangeConfiguration?: {
39
42
  algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
40
43
  gap: number;
@@ -43,7 +46,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
43
46
  mode: import("./types").NormaliseMode;
44
47
  metric: import("./types").NormaliseMetric;
45
48
  } | undefined;
46
- bindingPreference?: "enabled" | "disabled" | undefined;
49
+ bindingPreference?: "disabled" | "enabled" | undefined;
47
50
  preferredSelectionTool?: {
48
51
  type: "selection" | "lasso";
49
52
  initialized: boolean;
@@ -78,13 +81,10 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
78
81
  previousSelectedElementIds?: {
79
82
  [id: string]: true;
80
83
  } | undefined;
81
- gridStep?: number | undefined;
82
- gridModeEnabled?: boolean | undefined;
83
84
  stats?: {
84
85
  open: boolean;
85
86
  panels: number;
86
87
  } | undefined;
87
- objectsSnapModeEnabled?: boolean | undefined;
88
88
  lockedMultiSelections?: {
89
89
  [groupId: string]: true;
90
90
  } | undefined;
@@ -92,8 +92,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
92
92
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
93
93
  viewBackgroundColor?: string | undefined;
94
94
  gridSize?: number | undefined;
95
- gridStep?: number | undefined;
96
95
  gridModeEnabled?: boolean | undefined;
96
+ gridStep?: number | undefined;
97
97
  lockedMultiSelections?: {
98
98
  [groupId: string]: true;
99
99
  } | undefined;
@@ -101,8 +101,8 @@ export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
101
101
  export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
102
102
  viewBackgroundColor?: string | undefined;
103
103
  gridSize?: number | undefined;
104
- gridStep?: number | undefined;
105
104
  gridModeEnabled?: boolean | undefined;
105
+ gridStep?: number | undefined;
106
106
  lockedMultiSelections?: {
107
107
  [groupId: string]: true;
108
108
  } | undefined;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
3
- import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
3
+ import { FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
+ import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
5
  import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
6
  import type { Mutable } from "@excalidraw/common/utility-types";
6
7
  import { ActionManager } from "../actions/manager";
@@ -0,0 +1,263 @@
1
+ import type { AppClassProperties } from "../types";
2
+ export declare const SHAPES: readonly [{
3
+ readonly icon: import("react/jsx-runtime").JSX.Element;
4
+ readonly value: "hand";
5
+ readonly key: "h";
6
+ readonly numericKey: null;
7
+ readonly fillable: false;
8
+ readonly toolbar: true;
9
+ }, {
10
+ readonly icon: import("react/jsx-runtime").JSX.Element;
11
+ readonly value: "selection";
12
+ readonly key: "v";
13
+ readonly numericKey: "1";
14
+ readonly fillable: true;
15
+ readonly toolbar: true;
16
+ }, {
17
+ readonly icon: import("react/jsx-runtime").JSX.Element;
18
+ readonly value: "rectangle";
19
+ readonly key: "r";
20
+ readonly numericKey: "2";
21
+ readonly fillable: true;
22
+ readonly toolbar: true;
23
+ }, {
24
+ readonly icon: import("react/jsx-runtime").JSX.Element;
25
+ readonly value: "diamond";
26
+ readonly key: "d";
27
+ readonly numericKey: "3";
28
+ readonly fillable: true;
29
+ readonly toolbar: true;
30
+ }, {
31
+ readonly icon: import("react/jsx-runtime").JSX.Element;
32
+ readonly value: "ellipse";
33
+ readonly key: "o";
34
+ readonly numericKey: "4";
35
+ readonly fillable: true;
36
+ readonly toolbar: true;
37
+ }, {
38
+ readonly icon: import("react/jsx-runtime").JSX.Element;
39
+ readonly value: "arrow";
40
+ readonly key: "a";
41
+ readonly numericKey: "5";
42
+ readonly fillable: true;
43
+ readonly toolbar: true;
44
+ }, {
45
+ readonly icon: import("react/jsx-runtime").JSX.Element;
46
+ readonly value: "line";
47
+ readonly key: "l";
48
+ readonly numericKey: "6";
49
+ readonly fillable: true;
50
+ readonly toolbar: true;
51
+ }, {
52
+ readonly icon: import("react/jsx-runtime").JSX.Element;
53
+ readonly value: "freedraw";
54
+ readonly key: readonly ["p", "x"];
55
+ readonly numericKey: "7";
56
+ readonly fillable: false;
57
+ readonly toolbar: true;
58
+ }, {
59
+ readonly icon: import("react/jsx-runtime").JSX.Element;
60
+ readonly value: "text";
61
+ readonly key: "t";
62
+ readonly numericKey: "8";
63
+ readonly fillable: false;
64
+ readonly toolbar: true;
65
+ }, {
66
+ readonly icon: import("react/jsx-runtime").JSX.Element;
67
+ readonly value: "image";
68
+ readonly key: null;
69
+ readonly numericKey: "9";
70
+ readonly fillable: false;
71
+ readonly toolbar: true;
72
+ }, {
73
+ readonly icon: import("react/jsx-runtime").JSX.Element;
74
+ readonly value: "eraser";
75
+ readonly key: "e";
76
+ readonly numericKey: "0";
77
+ readonly fillable: false;
78
+ readonly toolbar: true;
79
+ }, {
80
+ readonly icon: import("react/jsx-runtime").JSX.Element;
81
+ readonly value: "laser";
82
+ readonly key: "k";
83
+ readonly numericKey: null;
84
+ readonly fillable: false;
85
+ readonly toolbar: false;
86
+ }];
87
+ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
88
+ readonly icon: import("react/jsx-runtime").JSX.Element;
89
+ readonly value: "hand";
90
+ readonly key: "h";
91
+ readonly numericKey: null;
92
+ readonly fillable: false;
93
+ readonly toolbar: true;
94
+ }, {
95
+ readonly icon: import("react/jsx-runtime").JSX.Element;
96
+ readonly value: "selection";
97
+ readonly key: "v";
98
+ readonly numericKey: "1";
99
+ readonly fillable: true;
100
+ readonly toolbar: true;
101
+ }, {
102
+ readonly icon: import("react/jsx-runtime").JSX.Element;
103
+ readonly value: "rectangle";
104
+ readonly key: "r";
105
+ readonly numericKey: "2";
106
+ readonly fillable: true;
107
+ readonly toolbar: true;
108
+ }, {
109
+ readonly icon: import("react/jsx-runtime").JSX.Element;
110
+ readonly value: "diamond";
111
+ readonly key: "d";
112
+ readonly numericKey: "3";
113
+ readonly fillable: true;
114
+ readonly toolbar: true;
115
+ }, {
116
+ readonly icon: import("react/jsx-runtime").JSX.Element;
117
+ readonly value: "ellipse";
118
+ readonly key: "o";
119
+ readonly numericKey: "4";
120
+ readonly fillable: true;
121
+ readonly toolbar: true;
122
+ }, {
123
+ readonly icon: import("react/jsx-runtime").JSX.Element;
124
+ readonly value: "arrow";
125
+ readonly key: "a";
126
+ readonly numericKey: "5";
127
+ readonly fillable: true;
128
+ readonly toolbar: true;
129
+ }, {
130
+ readonly icon: import("react/jsx-runtime").JSX.Element;
131
+ readonly value: "line";
132
+ readonly key: "l";
133
+ readonly numericKey: "6";
134
+ readonly fillable: true;
135
+ readonly toolbar: true;
136
+ }, {
137
+ readonly icon: import("react/jsx-runtime").JSX.Element;
138
+ readonly value: "freedraw";
139
+ readonly key: readonly ["p", "x"];
140
+ readonly numericKey: "7";
141
+ readonly fillable: false;
142
+ readonly toolbar: true;
143
+ }, {
144
+ readonly icon: import("react/jsx-runtime").JSX.Element;
145
+ readonly value: "text";
146
+ readonly key: "t";
147
+ readonly numericKey: "8";
148
+ readonly fillable: false;
149
+ readonly toolbar: true;
150
+ }, {
151
+ readonly icon: import("react/jsx-runtime").JSX.Element;
152
+ readonly value: "image";
153
+ readonly key: null;
154
+ readonly numericKey: "9";
155
+ readonly fillable: false;
156
+ readonly toolbar: true;
157
+ }, {
158
+ readonly icon: import("react/jsx-runtime").JSX.Element;
159
+ readonly value: "eraser";
160
+ readonly key: "e";
161
+ readonly numericKey: "0";
162
+ readonly fillable: false;
163
+ readonly toolbar: true;
164
+ }, {
165
+ readonly icon: import("react/jsx-runtime").JSX.Element;
166
+ readonly value: "laser";
167
+ readonly key: "k";
168
+ readonly numericKey: null;
169
+ readonly fillable: false;
170
+ readonly toolbar: false;
171
+ }] | readonly [{
172
+ readonly value: "lasso";
173
+ readonly icon: import("react/jsx-runtime").JSX.Element;
174
+ readonly key: "v";
175
+ readonly numericKey: "1";
176
+ readonly fillable: true;
177
+ readonly toolbar: true;
178
+ }, ...({
179
+ readonly icon: import("react/jsx-runtime").JSX.Element;
180
+ readonly value: "hand";
181
+ readonly key: "h";
182
+ readonly numericKey: null;
183
+ readonly fillable: false;
184
+ readonly toolbar: true;
185
+ } | {
186
+ readonly icon: import("react/jsx-runtime").JSX.Element;
187
+ readonly value: "selection";
188
+ readonly key: "v";
189
+ readonly numericKey: "1";
190
+ readonly fillable: true;
191
+ readonly toolbar: true;
192
+ } | {
193
+ readonly icon: import("react/jsx-runtime").JSX.Element;
194
+ readonly value: "rectangle";
195
+ readonly key: "r";
196
+ readonly numericKey: "2";
197
+ readonly fillable: true;
198
+ readonly toolbar: true;
199
+ } | {
200
+ readonly icon: import("react/jsx-runtime").JSX.Element;
201
+ readonly value: "diamond";
202
+ readonly key: "d";
203
+ readonly numericKey: "3";
204
+ readonly fillable: true;
205
+ readonly toolbar: true;
206
+ } | {
207
+ readonly icon: import("react/jsx-runtime").JSX.Element;
208
+ readonly value: "ellipse";
209
+ readonly key: "o";
210
+ readonly numericKey: "4";
211
+ readonly fillable: true;
212
+ readonly toolbar: true;
213
+ } | {
214
+ readonly icon: import("react/jsx-runtime").JSX.Element;
215
+ readonly value: "arrow";
216
+ readonly key: "a";
217
+ readonly numericKey: "5";
218
+ readonly fillable: true;
219
+ readonly toolbar: true;
220
+ } | {
221
+ readonly icon: import("react/jsx-runtime").JSX.Element;
222
+ readonly value: "line";
223
+ readonly key: "l";
224
+ readonly numericKey: "6";
225
+ readonly fillable: true;
226
+ readonly toolbar: true;
227
+ } | {
228
+ readonly icon: import("react/jsx-runtime").JSX.Element;
229
+ readonly value: "freedraw";
230
+ readonly key: readonly ["p", "x"];
231
+ readonly numericKey: "7";
232
+ readonly fillable: false;
233
+ readonly toolbar: true;
234
+ } | {
235
+ readonly icon: import("react/jsx-runtime").JSX.Element;
236
+ readonly value: "text";
237
+ readonly key: "t";
238
+ readonly numericKey: "8";
239
+ readonly fillable: false;
240
+ readonly toolbar: true;
241
+ } | {
242
+ readonly icon: import("react/jsx-runtime").JSX.Element;
243
+ readonly value: "image";
244
+ readonly key: null;
245
+ readonly numericKey: "9";
246
+ readonly fillable: false;
247
+ readonly toolbar: true;
248
+ } | {
249
+ readonly icon: import("react/jsx-runtime").JSX.Element;
250
+ readonly value: "eraser";
251
+ readonly key: "e";
252
+ readonly numericKey: "0";
253
+ readonly fillable: false;
254
+ readonly toolbar: true;
255
+ } | {
256
+ readonly icon: import("react/jsx-runtime").JSX.Element;
257
+ readonly value: "laser";
258
+ readonly key: "k";
259
+ readonly numericKey: null;
260
+ readonly fillable: false;
261
+ readonly toolbar: false;
262
+ })[]];
263
+ export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | null;
@@ -95,6 +95,12 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
95
95
  currentItemArrowType: "sharp" | "round" | "elbow";
96
96
  bindMode: import("@excalidraw/element/types").BindMode;
97
97
  gridSize: number;
98
+ gridModeEnabled: boolean;
99
+ objectsSnapModeEnabled: boolean;
100
+ wheelZoomsOnDefault?: boolean | undefined;
101
+ selectedElementsAreBeingDragged: boolean;
102
+ gridStep: number;
103
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
98
104
  contextMenu: {
99
105
  items: import("../components/ContextMenu").ContextMenuItems;
100
106
  top: number;
@@ -105,7 +111,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
105
111
  myocSimplifiedMode: boolean;
106
112
  dontResizeLimitMBs: number;
107
113
  hideMainMenus: boolean;
108
- wheelZoomsOnDefault?: boolean | undefined;
109
114
  arrangeConfiguration: {
110
115
  algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
111
116
  gap: number;
@@ -140,7 +145,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
140
145
  currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
141
146
  currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
142
147
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
143
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
144
148
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
145
149
  cursorButton: "up" | "down";
146
150
  scrolledOutside: boolean;
@@ -156,14 +160,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
156
160
  previousSelectedElementIds: {
157
161
  [id: string]: true;
158
162
  };
159
- selectedElementsAreBeingDragged: boolean;
160
163
  toast: {
161
164
  message: React.ReactNode;
162
165
  closable?: boolean;
163
166
  duration?: number;
164
167
  } | null;
165
- gridStep: number;
166
- gridModeEnabled: boolean;
167
168
  fileHandle: FileSystemFileHandle | null;
168
169
  stats: {
169
170
  open: boolean;
@@ -174,7 +175,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
174
175
  x: number;
175
176
  y: number;
176
177
  } | null;
177
- objectsSnapModeEnabled: boolean;
178
178
  userToFollow: import("../types").UserToFollow | null;
179
179
  followedBy: Set<import("../types").SocketId>;
180
180
  lockedMultiSelections: {
@@ -269,6 +269,12 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
269
269
  currentItemArrowType: "sharp" | "round" | "elbow";
270
270
  bindMode: import("@excalidraw/element/types").BindMode;
271
271
  gridSize: number;
272
+ gridModeEnabled: boolean;
273
+ objectsSnapModeEnabled: boolean;
274
+ wheelZoomsOnDefault?: boolean | undefined;
275
+ selectedElementsAreBeingDragged: boolean;
276
+ gridStep: number;
277
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
272
278
  contextMenu: {
273
279
  items: import("../components/ContextMenu").ContextMenuItems;
274
280
  top: number;
@@ -279,7 +285,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
279
285
  myocSimplifiedMode: boolean;
280
286
  dontResizeLimitMBs: number;
281
287
  hideMainMenus: boolean;
282
- wheelZoomsOnDefault?: boolean | undefined;
283
288
  arrangeConfiguration: {
284
289
  algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
285
290
  gap: number;
@@ -314,7 +319,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
314
319
  currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
315
320
  currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
316
321
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
317
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
318
322
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
319
323
  cursorButton: "up" | "down";
320
324
  scrolledOutside: boolean;
@@ -330,14 +334,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
330
334
  previousSelectedElementIds: {
331
335
  [id: string]: true;
332
336
  };
333
- selectedElementsAreBeingDragged: boolean;
334
337
  toast: {
335
338
  message: React.ReactNode;
336
339
  closable?: boolean;
337
340
  duration?: number;
338
341
  } | null;
339
- gridStep: number;
340
- gridModeEnabled: boolean;
341
342
  fileHandle: FileSystemFileHandle | null;
342
343
  stats: {
343
344
  open: boolean;
@@ -348,7 +349,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
348
349
  x: number;
349
350
  y: number;
350
351
  } | null;
351
- objectsSnapModeEnabled: boolean;
352
352
  userToFollow: import("../types").UserToFollow | null;
353
353
  followedBy: Set<import("../types").SocketId>;
354
354
  lockedMultiSelections: {
@@ -93,6 +93,12 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
93
93
  currentItemArrowType: "sharp" | "round" | "elbow";
94
94
  bindMode: import("@excalidraw/element/types").BindMode;
95
95
  gridSize: number;
96
+ gridModeEnabled: boolean;
97
+ objectsSnapModeEnabled: boolean;
98
+ wheelZoomsOnDefault?: boolean | undefined;
99
+ selectedElementsAreBeingDragged: boolean;
100
+ gridStep: number;
101
+ currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
96
102
  contextMenu: {
97
103
  items: import("../components/ContextMenu").ContextMenuItems;
98
104
  top: number;
@@ -103,7 +109,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
103
109
  myocSimplifiedMode: boolean;
104
110
  dontResizeLimitMBs: number;
105
111
  hideMainMenus: boolean;
106
- wheelZoomsOnDefault?: boolean | undefined;
107
112
  arrangeConfiguration: {
108
113
  algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
109
114
  gap: number;
@@ -138,7 +143,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
138
143
  currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
139
144
  currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
140
145
  currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
141
- currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
142
146
  currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
143
147
  cursorButton: "up" | "down";
144
148
  scrolledOutside: boolean;
@@ -154,14 +158,11 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
154
158
  previousSelectedElementIds: {
155
159
  [id: string]: true;
156
160
  };
157
- selectedElementsAreBeingDragged: boolean;
158
161
  toast: {
159
162
  message: React.ReactNode;
160
163
  closable?: boolean;
161
164
  duration?: number;
162
165
  } | null;
163
- gridStep: number;
164
- gridModeEnabled: boolean;
165
166
  fileHandle: FileSystemFileHandle | null;
166
167
  stats: {
167
168
  open: boolean;
@@ -172,7 +173,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
172
173
  x: number;
173
174
  y: number;
174
175
  } | null;
175
- objectsSnapModeEnabled: boolean;
176
176
  userToFollow: import("../types").UserToFollow | null;
177
177
  followedBy: Set<import("../types").SocketId>;
178
178
  lockedMultiSelections: {
@@ -0,0 +1,11 @@
1
+ import type { AppState, ArrangePreferences, EditorPreferences, NormalisePreferences, SmartZoomPreferences } from "./types";
2
+ export type ResolvedSmartZoomPreferences = Required<SmartZoomPreferences>;
3
+ export type ResolvedArrangePreferences = Required<ArrangePreferences>;
4
+ export type ResolvedNormalisePreferences = Required<NormalisePreferences>;
5
+ export type ResolvedEditorPreferences = {
6
+ smartZoom: ResolvedSmartZoomPreferences;
7
+ arrange: ResolvedArrangePreferences;
8
+ normalise: ResolvedNormalisePreferences;
9
+ };
10
+ export declare const DEFAULT_SMART_ZOOM_PREFERENCES: ResolvedSmartZoomPreferences;
11
+ export declare const getEffectiveEditorPreferences: (appState: Readonly<Pick<AppState, "arrangeConfiguration" | "normaliseConfiguration">>, editorPreferences?: EditorPreferences) => ResolvedEditorPreferences;
@@ -51,6 +51,7 @@ export { isElementLink } from "@excalidraw/element";
51
51
  export { Fonts } from "./fonts/Fonts";
52
52
  export { setCustomTextMetricsProvider } from "@excalidraw/element";
53
53
  export { CommandPalette } from "./components/CommandPalette/CommandPalette";
54
+ export type { ArrangePreferences, EditorPreferences, NormalisePreferences, SmartZoomPreferences, } from "./types";
54
55
  export { renderSpreadsheet, tryParseSpreadsheet, isSpreadsheetValidForChartType, } from "./charts";
55
56
  /**
56
57
  * hook that subscribes to specific appState prop(s)
@@ -174,6 +174,25 @@ export type ObservedElementsAppState = {
174
174
  };
175
175
  export type NormaliseMode = "first" | "average";
176
176
  export type NormaliseMetric = "scale" | "height" | "width" | "size";
177
+ export type SmartZoomPreferences = {
178
+ fitToViewport?: boolean;
179
+ animate?: boolean;
180
+ duration?: number;
181
+ viewportZoomFactor?: number;
182
+ };
183
+ export type ArrangePreferences = {
184
+ algorithm?: ArrangeAlgorithms;
185
+ gap?: number;
186
+ };
187
+ export type NormalisePreferences = {
188
+ mode?: NormaliseMode;
189
+ metric?: NormaliseMetric;
190
+ };
191
+ export type EditorPreferences = {
192
+ smartZoom?: SmartZoomPreferences;
193
+ arrange?: ArrangePreferences;
194
+ normalise?: NormalisePreferences;
195
+ };
177
196
  export interface AppState {
178
197
  contextMenu: {
179
198
  items: ContextMenuItems;
@@ -511,6 +530,8 @@ export interface ExcalidrawProps {
511
530
  theme?: Theme;
512
531
  name?: string;
513
532
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
533
+ editorPreferences?: EditorPreferences;
534
+ onEditorPreferencesChange?: (next: EditorPreferences) => void;
514
535
  UIOptions?: Partial<UIOptions>;
515
536
  detectScroll?: boolean;
516
537
  handleKeyboardGlobally?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/excalidraw",
3
- "version": "0.19.503",
3
+ "version": "0.19.504",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -110,9 +110,9 @@
110
110
  "roughjs": "4.6.4",
111
111
  "sass": "1.51.0",
112
112
  "tunnel-rat": "0.1.2",
113
- "@excalidraw/common": "npm:@myoc/common@0.19.503",
114
- "@excalidraw/math": "npm:@myoc/math@0.19.503",
115
- "@excalidraw/element": "npm:@myoc/element@0.19.503"
113
+ "@excalidraw/common": "npm:@myoc/common@0.19.504",
114
+ "@excalidraw/math": "npm:@myoc/math@0.19.504",
115
+ "@excalidraw/element": "npm:@myoc/element@0.19.504"
116
116
  },
117
117
  "devDependencies": {
118
118
  "@size-limit/preset-big-lib": "9.0.0",