@myoc/excalidraw 0.19.506 → 0.19.508

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 (86) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/dev/{chunk-CUCA2WKB.js → chunk-4FUVQKPQ.js} +37 -43
  3. package/dist/dev/chunk-4FUVQKPQ.js.map +7 -0
  4. package/dist/dev/{chunk-KLM3KPI7.js → chunk-55P7U5EB.js} +4 -1
  5. package/dist/dev/chunk-55P7U5EB.js.map +7 -0
  6. package/dist/dev/{chunk-KCN2IL3S.js → chunk-TW3GG6X2.js} +2 -2
  7. package/dist/dev/data/{image-KG7C5ZXU.js → image-BLMJ34ZZ.js} +3 -3
  8. package/dist/dev/index.css +11 -3
  9. package/dist/dev/index.css.map +2 -2
  10. package/dist/dev/index.js +1391 -972
  11. package/dist/dev/index.js.map +4 -4
  12. package/dist/dev/locales/{en-I7VEBYIX.js → en-MHJYLCUG.js} +2 -2
  13. package/dist/dev/subset-shared.chunk.js +1 -1
  14. package/dist/dev/subset-worker.chunk.js +1 -1
  15. package/dist/prod/chunk-5HKPV526.js +4 -0
  16. package/dist/prod/{chunk-74H5OWWZ.js → chunk-GYDQTBSQ.js} +1 -1
  17. package/dist/prod/{chunk-3FGJVPJS.js → chunk-QIZKYIJ7.js} +3 -3
  18. package/dist/prod/data/image-S4O4TFPQ.js +1 -0
  19. package/dist/prod/index.css +1 -1
  20. package/dist/prod/index.js +19 -19
  21. package/dist/prod/locales/{en-Y2V7YPBM.js → en-YKHOUQAO.js} +1 -1
  22. package/dist/prod/subset-shared.chunk.js +1 -1
  23. package/dist/prod/subset-worker.chunk.js +1 -1
  24. package/dist/types/element/src/Scene.d.ts +5 -3
  25. package/dist/types/element/src/bounds.d.ts +4 -2
  26. package/dist/types/element/src/duplicate.d.ts +1 -0
  27. package/dist/types/element/src/frame.d.ts +7 -6
  28. package/dist/types/element/src/linearElementEditor.d.ts +2 -2
  29. package/dist/types/element/src/selection.d.ts +2 -2
  30. package/dist/types/element/src/shape.d.ts +1 -1
  31. package/dist/types/element/src/typeChecks.d.ts +1 -0
  32. package/dist/types/element/src/utils.d.ts +1 -1
  33. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
  34. package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -2
  35. package/dist/types/excalidraw/actions/actionCanvas.d.ts +11 -11
  36. package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -2
  37. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
  38. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
  39. package/dist/types/excalidraw/actions/actionDeselect.d.ts +168 -0
  40. package/dist/types/excalidraw/actions/actionElementLink.d.ts +1 -1
  41. package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  42. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  43. package/dist/types/excalidraw/actions/actionExport.d.ts +2 -2
  44. package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -4
  45. package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
  46. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -1
  47. package/dist/types/excalidraw/actions/actionLink.d.ts +1 -1
  48. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
  49. package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -2
  50. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
  51. package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -1
  52. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -1
  53. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
  54. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -1
  55. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
  56. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -1
  57. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
  58. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
  59. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
  60. package/dist/types/excalidraw/actions/index.d.ts +1 -0
  61. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  62. package/dist/types/excalidraw/appState.d.ts +1 -0
  63. package/dist/types/excalidraw/components/App.d.ts +9 -0
  64. package/dist/types/excalidraw/components/PublishLibrary.d.ts +3 -2
  65. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -1
  66. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
  67. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  68. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  69. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -0
  70. package/dist/types/excalidraw/components/shapes.d.ts +7 -0
  71. package/dist/types/excalidraw/data/blob.d.ts +4 -8
  72. package/dist/types/excalidraw/data/json.d.ts +1 -1
  73. package/dist/types/excalidraw/index.d.ts +1 -1
  74. package/dist/types/excalidraw/scene/Renderer.d.ts +425 -19
  75. package/dist/types/excalidraw/types.d.ts +15 -2
  76. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  77. package/dist/types/math/src/constants.d.ts +0 -1
  78. package/dist/types/math/src/curve.d.ts +4 -1
  79. package/package.json +4 -5
  80. package/dist/dev/chunk-CUCA2WKB.js.map +0 -7
  81. package/dist/dev/chunk-KLM3KPI7.js.map +0 -7
  82. package/dist/prod/chunk-DAHBMDEO.js +0 -4
  83. package/dist/prod/data/image-OZR7E4WV.js +0 -1
  84. /package/dist/dev/{chunk-KCN2IL3S.js.map → chunk-TW3GG6X2.js.map} +0 -0
  85. /package/dist/dev/data/{image-KG7C5ZXU.js.map → image-BLMJ34ZZ.js.map} +0 -0
  86. /package/dist/dev/locales/{en-I7VEBYIX.js.map → en-MHJYLCUG.js.map} +0 -0
@@ -1,30 +1,436 @@
1
- import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { RenderableElementsMap } from "./types";
4
4
  import type { AppState } from "../types";
5
+ type GetRenderableElementsOpts = {
6
+ zoom: AppState["zoom"];
7
+ offsetLeft: AppState["offsetLeft"];
8
+ offsetTop: AppState["offsetTop"];
9
+ scrollX: AppState["scrollX"];
10
+ scrollY: AppState["scrollY"];
11
+ height: AppState["height"];
12
+ width: AppState["width"];
13
+ editingTextElement: AppState["editingTextElement"];
14
+ newElement: AppState["newElement"];
15
+ selectedElements: readonly NonDeletedExcalidrawElement[];
16
+ selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
17
+ frameToHighlight: AppState["frameToHighlight"];
18
+ };
5
19
  export declare class Renderer {
6
20
  private scene;
7
21
  constructor(scene: Scene);
8
- getRenderableElements: ((opts: {
9
- zoom: Readonly<{
10
- value: import("../types").NormalizedZoomValue;
11
- }>;
12
- offsetLeft: AppState["offsetLeft"];
13
- offsetTop: AppState["offsetTop"];
14
- scrollX: AppState["scrollX"];
15
- scrollY: AppState["scrollY"];
16
- height: AppState["height"];
17
- width: AppState["width"];
18
- editingTextElement: AppState["editingTextElement"];
19
- /** note: first render of newElement will always bust the cache
20
- * (we'd have to prefilter elements outside of this function) */
21
- newElementId: ExcalidrawElement["id"] | undefined;
22
- sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
23
- }) => {
22
+ private getVisibleCanvasElements;
23
+ private getRenderableElementsMap;
24
+ private sortSelectedElementsIntoHighlightedFrame;
25
+ private _getRenderableElements;
26
+ getRenderableElements: (opts: GetRenderableElementsOpts) => {
24
27
  elementsMap: RenderableElementsMap;
25
28
  visibleElements: readonly NonDeletedExcalidrawElement[];
26
- }) & {
27
- clear: () => void;
29
+ newElementCanvasElement: (Readonly<{
30
+ id: string;
31
+ x: number;
32
+ y: number;
33
+ strokeColor: string;
34
+ backgroundColor: string;
35
+ fillStyle: import("@excalidraw/element/types").FillStyle;
36
+ strokeWidth: number;
37
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
38
+ roundness: null | {
39
+ type: import("@excalidraw/element/types").RoundnessType;
40
+ value?: number;
41
+ };
42
+ roughness: number;
43
+ opacity: number;
44
+ width: number;
45
+ height: number;
46
+ angle: import("@excalidraw/math").Radians;
47
+ seed: number;
48
+ version: number;
49
+ versionNonce: number;
50
+ index: import("@excalidraw/element/types").FractionalIndex | null;
51
+ isDeleted: boolean;
52
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
53
+ frameId: string | null;
54
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
55
+ updated: number;
56
+ link: string | null;
57
+ locked: boolean;
58
+ customData?: Record<string, any>;
59
+ }> & Readonly<{
60
+ type: "line" | "arrow";
61
+ points: readonly import("@excalidraw/math").LocalPoint[];
62
+ startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
63
+ endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
64
+ startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
65
+ endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
66
+ }> & {
67
+ isDeleted: boolean;
68
+ }) | (Readonly<{
69
+ id: string;
70
+ x: number;
71
+ y: number;
72
+ strokeColor: string;
73
+ backgroundColor: string;
74
+ fillStyle: import("@excalidraw/element/types").FillStyle;
75
+ strokeWidth: number;
76
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
77
+ roundness: null | {
78
+ type: import("@excalidraw/element/types").RoundnessType;
79
+ value?: number;
80
+ };
81
+ roughness: number;
82
+ opacity: number;
83
+ width: number;
84
+ height: number;
85
+ angle: import("@excalidraw/math").Radians;
86
+ seed: number;
87
+ version: number;
88
+ versionNonce: number;
89
+ index: import("@excalidraw/element/types").FractionalIndex | null;
90
+ isDeleted: boolean;
91
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
92
+ frameId: string | null;
93
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
94
+ updated: number;
95
+ link: string | null;
96
+ locked: boolean;
97
+ customData?: Record<string, any>;
98
+ }> & {
99
+ type: "rectangle";
100
+ } & {
101
+ isDeleted: boolean;
102
+ }) | (Readonly<{
103
+ id: string;
104
+ x: number;
105
+ y: number;
106
+ strokeColor: string;
107
+ backgroundColor: string;
108
+ fillStyle: import("@excalidraw/element/types").FillStyle;
109
+ strokeWidth: number;
110
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
111
+ roundness: null | {
112
+ type: import("@excalidraw/element/types").RoundnessType;
113
+ value?: number;
114
+ };
115
+ roughness: number;
116
+ opacity: number;
117
+ width: number;
118
+ height: number;
119
+ angle: import("@excalidraw/math").Radians;
120
+ seed: number;
121
+ version: number;
122
+ versionNonce: number;
123
+ index: import("@excalidraw/element/types").FractionalIndex | null;
124
+ isDeleted: boolean;
125
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
126
+ frameId: string | null;
127
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
128
+ updated: number;
129
+ link: string | null;
130
+ locked: boolean;
131
+ customData?: Record<string, any>;
132
+ }> & {
133
+ type: "diamond";
134
+ } & {
135
+ isDeleted: boolean;
136
+ }) | (Readonly<{
137
+ id: string;
138
+ x: number;
139
+ y: number;
140
+ strokeColor: string;
141
+ backgroundColor: string;
142
+ fillStyle: import("@excalidraw/element/types").FillStyle;
143
+ strokeWidth: number;
144
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
145
+ roundness: null | {
146
+ type: import("@excalidraw/element/types").RoundnessType;
147
+ value?: number;
148
+ };
149
+ roughness: number;
150
+ opacity: number;
151
+ width: number;
152
+ height: number;
153
+ angle: import("@excalidraw/math").Radians;
154
+ seed: number;
155
+ version: number;
156
+ versionNonce: number;
157
+ index: import("@excalidraw/element/types").FractionalIndex | null;
158
+ isDeleted: boolean;
159
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
160
+ frameId: string | null;
161
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
162
+ updated: number;
163
+ link: string | null;
164
+ locked: boolean;
165
+ customData?: Record<string, any>;
166
+ }> & {
167
+ type: "ellipse";
168
+ } & {
169
+ isDeleted: boolean;
170
+ }) | (Readonly<{
171
+ id: string;
172
+ x: number;
173
+ y: number;
174
+ strokeColor: string;
175
+ backgroundColor: string;
176
+ fillStyle: import("@excalidraw/element/types").FillStyle;
177
+ strokeWidth: number;
178
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
179
+ roundness: null | {
180
+ type: import("@excalidraw/element/types").RoundnessType;
181
+ value?: number;
182
+ };
183
+ roughness: number;
184
+ opacity: number;
185
+ width: number;
186
+ height: number;
187
+ angle: import("@excalidraw/math").Radians;
188
+ seed: number;
189
+ version: number;
190
+ versionNonce: number;
191
+ index: import("@excalidraw/element/types").FractionalIndex | null;
192
+ isDeleted: boolean;
193
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
194
+ frameId: string | null;
195
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
196
+ updated: number;
197
+ link: string | null;
198
+ locked: boolean;
199
+ customData?: Record<string, any>;
200
+ }> & Readonly<{
201
+ type: "embeddable";
202
+ }> & {
203
+ isDeleted: boolean;
204
+ }) | (Readonly<{
205
+ id: string;
206
+ x: number;
207
+ y: number;
208
+ strokeColor: string;
209
+ backgroundColor: string;
210
+ fillStyle: import("@excalidraw/element/types").FillStyle;
211
+ strokeWidth: number;
212
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
213
+ roundness: null | {
214
+ type: import("@excalidraw/element/types").RoundnessType;
215
+ value?: number;
216
+ };
217
+ roughness: number;
218
+ opacity: number;
219
+ width: number;
220
+ height: number;
221
+ angle: import("@excalidraw/math").Radians;
222
+ seed: number;
223
+ version: number;
224
+ versionNonce: number;
225
+ index: import("@excalidraw/element/types").FractionalIndex | null;
226
+ isDeleted: boolean;
227
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
228
+ frameId: string | null;
229
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
230
+ updated: number;
231
+ link: string | null;
232
+ locked: boolean;
233
+ customData?: Record<string, any>;
234
+ }> & Readonly<{
235
+ type: "iframe";
236
+ customData?: {
237
+ generationData?: import("@excalidraw/element/types").MagicGenerationData;
238
+ };
239
+ }> & {
240
+ isDeleted: boolean;
241
+ }) | (Readonly<{
242
+ id: string;
243
+ x: number;
244
+ y: number;
245
+ strokeColor: string;
246
+ backgroundColor: string;
247
+ fillStyle: import("@excalidraw/element/types").FillStyle;
248
+ strokeWidth: number;
249
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
250
+ roundness: null | {
251
+ type: import("@excalidraw/element/types").RoundnessType;
252
+ value?: number;
253
+ };
254
+ roughness: number;
255
+ opacity: number;
256
+ width: number;
257
+ height: number;
258
+ angle: import("@excalidraw/math").Radians;
259
+ seed: number;
260
+ version: number;
261
+ versionNonce: number;
262
+ index: import("@excalidraw/element/types").FractionalIndex | null;
263
+ isDeleted: boolean;
264
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
265
+ frameId: string | null;
266
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
267
+ updated: number;
268
+ link: string | null;
269
+ locked: boolean;
270
+ customData?: Record<string, any>;
271
+ }> & Readonly<{
272
+ type: "image";
273
+ fileId: import("@excalidraw/element/types").FileId | null;
274
+ status: "pending" | "saved" | "error";
275
+ scale: [number, number];
276
+ crop: import("@excalidraw/element/types").ImageCrop | null;
277
+ }> & {
278
+ isDeleted: boolean;
279
+ }) | (Readonly<{
280
+ id: string;
281
+ x: number;
282
+ y: number;
283
+ strokeColor: string;
284
+ backgroundColor: string;
285
+ fillStyle: import("@excalidraw/element/types").FillStyle;
286
+ strokeWidth: number;
287
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
288
+ roundness: null | {
289
+ type: import("@excalidraw/element/types").RoundnessType;
290
+ value?: number;
291
+ };
292
+ roughness: number;
293
+ opacity: number;
294
+ width: number;
295
+ height: number;
296
+ angle: import("@excalidraw/math").Radians;
297
+ seed: number;
298
+ version: number;
299
+ versionNonce: number;
300
+ index: import("@excalidraw/element/types").FractionalIndex | null;
301
+ isDeleted: boolean;
302
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
303
+ frameId: string | null;
304
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
305
+ updated: number;
306
+ link: string | null;
307
+ locked: boolean;
308
+ customData?: Record<string, any>;
309
+ }> & {
310
+ type: "frame";
311
+ name: string | null;
312
+ } & {
313
+ isDeleted: boolean;
314
+ }) | (Readonly<{
315
+ id: string;
316
+ x: number;
317
+ y: number;
318
+ strokeColor: string;
319
+ backgroundColor: string;
320
+ fillStyle: import("@excalidraw/element/types").FillStyle;
321
+ strokeWidth: number;
322
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
323
+ roundness: null | {
324
+ type: import("@excalidraw/element/types").RoundnessType;
325
+ value?: number;
326
+ };
327
+ roughness: number;
328
+ opacity: number;
329
+ width: number;
330
+ height: number;
331
+ angle: import("@excalidraw/math").Radians;
332
+ seed: number;
333
+ version: number;
334
+ versionNonce: number;
335
+ index: import("@excalidraw/element/types").FractionalIndex | null;
336
+ isDeleted: boolean;
337
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
338
+ frameId: string | null;
339
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
340
+ updated: number;
341
+ link: string | null;
342
+ locked: boolean;
343
+ customData?: Record<string, any>;
344
+ }> & {
345
+ type: "magicframe";
346
+ name: string | null;
347
+ } & {
348
+ isDeleted: boolean;
349
+ }) | (Readonly<{
350
+ id: string;
351
+ x: number;
352
+ y: number;
353
+ strokeColor: string;
354
+ backgroundColor: string;
355
+ fillStyle: import("@excalidraw/element/types").FillStyle;
356
+ strokeWidth: number;
357
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
358
+ roundness: null | {
359
+ type: import("@excalidraw/element/types").RoundnessType;
360
+ value?: number;
361
+ };
362
+ roughness: number;
363
+ opacity: number;
364
+ width: number;
365
+ height: number;
366
+ angle: import("@excalidraw/math").Radians;
367
+ seed: number;
368
+ version: number;
369
+ versionNonce: number;
370
+ index: import("@excalidraw/element/types").FractionalIndex | null;
371
+ isDeleted: boolean;
372
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
373
+ frameId: string | null;
374
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
375
+ updated: number;
376
+ link: string | null;
377
+ locked: boolean;
378
+ customData?: Record<string, any>;
379
+ }> & Readonly<{
380
+ type: "text";
381
+ fontSize: number;
382
+ fontFamily: import("@excalidraw/element/types").FontFamilyValues;
383
+ text: string;
384
+ textAlign: import("@excalidraw/element/types").TextAlign;
385
+ verticalAlign: import("@excalidraw/element/types").VerticalAlign;
386
+ containerId: import("@excalidraw/element/types").ExcalidrawGenericElement["id"] | null;
387
+ originalText: string;
388
+ autoResize: boolean;
389
+ lineHeight: number & {
390
+ _brand: "unitlessLineHeight";
391
+ };
392
+ }> & {
393
+ isDeleted: boolean;
394
+ }) | (Readonly<{
395
+ id: string;
396
+ x: number;
397
+ y: number;
398
+ strokeColor: string;
399
+ backgroundColor: string;
400
+ fillStyle: import("@excalidraw/element/types").FillStyle;
401
+ strokeWidth: number;
402
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
403
+ roundness: null | {
404
+ type: import("@excalidraw/element/types").RoundnessType;
405
+ value?: number;
406
+ };
407
+ roughness: number;
408
+ opacity: number;
409
+ width: number;
410
+ height: number;
411
+ angle: import("@excalidraw/math").Radians;
412
+ seed: number;
413
+ version: number;
414
+ versionNonce: number;
415
+ index: import("@excalidraw/element/types").FractionalIndex | null;
416
+ isDeleted: boolean;
417
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
418
+ frameId: string | null;
419
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
420
+ updated: number;
421
+ link: string | null;
422
+ locked: boolean;
423
+ customData?: Record<string, any>;
424
+ }> & Readonly<{
425
+ type: "freedraw";
426
+ points: readonly import("@excalidraw/math").LocalPoint[];
427
+ pressures: readonly number[];
428
+ simulatePressure: boolean;
429
+ }> & {
430
+ isDeleted: boolean;
431
+ }) | null;
432
+ canvasNonce: string;
28
433
  };
29
434
  destroy(): void;
30
435
  }
436
+ export {};
@@ -193,6 +193,7 @@ export type EditorPreferences = {
193
193
  arrange?: ArrangePreferences;
194
194
  normalise?: NormalisePreferences;
195
195
  };
196
+ export type BoxSelectionMode = "contain" | "overlap";
196
197
  export interface AppState {
197
198
  contextMenu: {
198
199
  items: ContextMenuItems;
@@ -243,11 +244,16 @@ export interface AppState {
243
244
  * `bindingPreference` and keyboard modifiers (ctrl/alt)
244
245
  */
245
246
  isBindingEnabled: boolean;
247
+ /** user box selection preference; defaults to "contain" when unset */
248
+ boxSelectionMode: BoxSelectionMode;
246
249
  /** user arrow binding preference */
247
250
  bindingPreference: "enabled" | "disabled";
248
251
  /** user preference whether arrow snap to midpoints while binding */
249
252
  isMidpointSnappingEnabled: boolean;
250
- startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
253
+ /**
254
+ * The bindable element the UI highlights for the user when an arrow is
255
+ * dragged or otherwise its endpoint being close to said element.
256
+ */
251
257
  suggestedBinding: {
252
258
  element: NonDeleted<ExcalidrawBindableElement>;
253
259
  midPoint?: GlobalPoint;
@@ -416,7 +422,7 @@ export type SearchMatch = {
416
422
  showOnCanvas: boolean;
417
423
  }[];
418
424
  };
419
- export type UIAppState = Omit<AppState, "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
425
+ export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY">;
420
426
  export type NormalizedZoomValue = number & {
421
427
  _brand: "normalizedZoom";
422
428
  };
@@ -470,6 +476,12 @@ export type OnExportProgress = {
470
476
  /** 0-1 range */
471
477
  progress?: number;
472
478
  };
479
+ export type CompressImageFileOpts = {
480
+ /** undefined indicates auto */
481
+ outputType?: typeof MIME_TYPES["jpg"];
482
+ maxWidthOrHeight: number;
483
+ };
484
+ export type CompressImageFile = (file: File, opts: CompressImageFileOpts) => Promise<File>;
473
485
  export interface ExcalidrawProps {
474
486
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
475
487
  /**
@@ -537,6 +549,7 @@ export interface ExcalidrawProps {
537
549
  handleKeyboardGlobally?: boolean;
538
550
  onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
539
551
  autoFocus?: boolean;
552
+ compressImageFile: CompressImageFile;
540
553
  generateIdForFile?: (file: File) => string | Promise<string>;
541
554
  generateLinkForSelection?: (id: string, type: "element" | "group") => string;
542
555
  onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
@@ -0,0 +1,29 @@
1
+ export declare const BASE_62_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
2
+ /**
3
+ * @param {string} key
4
+ * @param {string} digits
5
+ * @return {void}
6
+ */
7
+ export declare function validateOrderKey(key: string, digits?: string): void;
8
+ /**
9
+ * @param {string | null | undefined} a
10
+ * @param {string | null | undefined} b
11
+ * @param {string=} digits
12
+ * @return {string}
13
+ */
14
+ export declare function generateKeyBetween(a: string | null | undefined, b: string | null | undefined, digits?: string): string;
15
+ /**
16
+ * same preconditions as generateKeysBetween.
17
+ * n >= 0.
18
+ * Returns an array of n distinct keys in sorted order.
19
+ * If a and b are both null, returns [a0, a1, ...]
20
+ * If one or the other is null, returns consecutive "integer"
21
+ * keys. Otherwise, returns relatively short keys between
22
+ * a and b.
23
+ * @param {string | null | undefined} a
24
+ * @param {string | null | undefined} b
25
+ * @param {number} n
26
+ * @param {string} digits
27
+ * @return {string[]}
28
+ */
29
+ export declare function generateNKeysBetween(a: string | null | undefined, b: string | null | undefined, n: number, digits?: string): string[];
@@ -1,3 +1,2 @@
1
- export declare const PRECISION = 0.0001;
2
1
  export declare const LegendreGaussN24TValues: number[];
3
2
  export declare const LegendreGaussN24CValues: number[];
@@ -12,7 +12,10 @@ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c:
12
12
  /**
13
13
  * Computes the intersection between a cubic spline and a line segment.
14
14
  */
15
- export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>): Point[];
15
+ export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>, opts?: {
16
+ tolerance?: number;
17
+ iterLimit?: number;
18
+ }): Point[];
16
19
  /**
17
20
  * Finds the closest point on the Bezier curve from another point
18
21
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/excalidraw",
3
- "version": "0.19.506",
3
+ "version": "0.19.508",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -90,7 +90,6 @@
90
90
  "clsx": "1.1.1",
91
91
  "cross-env": "7.0.3",
92
92
  "es6-promise-pool": "2.5.0",
93
- "fractional-indexing": "3.2.0",
94
93
  "fuzzy": "0.1.3",
95
94
  "image-blob-reduce": "3.0.1",
96
95
  "jotai": "2.11.0",
@@ -110,9 +109,9 @@
110
109
  "roughjs": "4.6.4",
111
110
  "sass": "1.51.0",
112
111
  "tunnel-rat": "0.1.2",
113
- "@excalidraw/common": "npm:@myoc/common@0.19.506",
114
- "@excalidraw/math": "npm:@myoc/math@0.19.506",
115
- "@excalidraw/element": "npm:@myoc/element@0.19.506"
112
+ "@excalidraw/common": "npm:@myoc/common@0.19.508",
113
+ "@excalidraw/math": "npm:@myoc/math@0.19.508",
114
+ "@excalidraw/element": "npm:@myoc/element@0.19.508"
116
115
  },
117
116
  "devDependencies": {
118
117
  "@size-limit/preset-big-lib": "9.0.0",