@dwelle/excalidraw 0.3.63 → 0.3.64

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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README_NEXT.md +149 -32
  3. package/dist/excalidraw.development.js +38 -38
  4. package/dist/excalidraw.production.min.js +1 -1
  5. package/package.json +8 -8
  6. package/types/actions/actionAddToLibrary.d.ts +21 -3
  7. package/types/actions/actionBoundText.d.ts +7 -1
  8. package/types/actions/actionCanvas.d.ts +57 -9
  9. package/types/actions/actionClipboard.d.ts +36 -6
  10. package/types/actions/actionDeleteSelected.d.ts +22 -4
  11. package/types/actions/actionDuplicateSelection.d.ts +1 -1
  12. package/types/actions/actionExport.d.ts +64 -10
  13. package/types/actions/actionFinalize.d.ts +18 -5
  14. package/types/actions/actionMenu.d.ts +21 -3
  15. package/types/actions/actionProperties.d.ts +91 -13
  16. package/types/actions/actionStyles.d.ts +7 -1
  17. package/types/actions/actionToggleGridMode.d.ts +7 -1
  18. package/types/actions/actionToggleStats.d.ts +7 -1
  19. package/types/actions/actionToggleViewMode.d.ts +7 -1
  20. package/types/actions/actionToggleZenMode.d.ts +7 -1
  21. package/types/appState.d.ts +8 -2
  22. package/types/charts.d.ts +8 -0
  23. package/types/clipboard.d.ts +1 -1
  24. package/types/components/App.d.ts +3 -2
  25. package/types/components/Avatar.d.ts +3 -2
  26. package/types/components/LibraryMenuItems.d.ts +4 -3
  27. package/types/data/blob.d.ts +20 -1
  28. package/types/data/library.d.ts +37 -49
  29. package/types/element/Hyperlink.d.ts +7 -1
  30. package/types/element/linearElementEditor.d.ts +7 -1
  31. package/types/packages/excalidraw/dist/excalidraw.production.min.d.ts +1 -3
  32. package/types/packages/excalidraw/index.d.ts +2 -3
  33. package/types/packages/utils.d.ts +7 -3
  34. package/types/scene/Scene.d.ts +1 -2
  35. package/types/types.d.ts +18 -2
  36. package/types/utils.d.ts +10 -1
@@ -1,5 +1,7 @@
1
1
  import { AppState, BinaryFiles } from "../types";
2
2
  import { ExcalidrawElement, NonDeleted } from "../element/types";
3
+ import { MIME_TYPES } from "../constants";
4
+ export { MIME_TYPES };
3
5
  declare type ExportOpts = {
4
6
  elements: readonly NonDeleted<ExcalidrawElement>[];
5
7
  appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
@@ -15,14 +17,16 @@ export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHei
15
17
  export declare const exportToBlob: (opts: ExportOpts & {
16
18
  mimeType?: string;
17
19
  quality?: number;
18
- }) => Promise<Blob | null>;
20
+ }) => Promise<Blob>;
19
21
  export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
20
22
  exportPadding?: number | undefined;
21
23
  }) => Promise<SVGSVGElement>;
22
- export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
23
24
  export declare const exportToClipboard: (opts: ExportOpts & {
24
25
  mimeType?: string;
25
26
  quality?: number;
27
+ type: "png" | "svg" | "json";
26
28
  }) => Promise<void>;
27
- export { loadFromBlob, loadLibraryFromBlob } from "../data/blob";
29
+ export { serializeAsJSON, serializeLibraryAsJSON } from "../data/json";
30
+ export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "../data/blob";
28
31
  export { getFreeDrawSvgPath } from "../renderer/renderElement";
32
+ export { mergeLibraryItems } from "../data/library";
@@ -14,10 +14,9 @@ declare class Scene {
14
14
  private elements;
15
15
  private elementsMap;
16
16
  getElementsIncludingDeleted(): readonly ExcalidrawElement[];
17
- getElements(): readonly NonDeletedExcalidrawElement[];
17
+ getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
18
18
  getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
19
19
  getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
20
- getNonDeletedElements(ids: readonly ExcalidrawElement["id"][]): NonDeleted<ExcalidrawElement>[];
21
20
  replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
22
21
  informMutation(): void;
23
22
  addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
package/types/types.d.ts CHANGED
@@ -29,7 +29,7 @@ export declare type Collaborator = {
29
29
  background: string;
30
30
  stroke: string;
31
31
  };
32
- picture?: string;
32
+ src?: string;
33
33
  };
34
34
  export declare type DataURL = string & {
35
35
  _brand: "DataURL";
@@ -42,6 +42,13 @@ export declare type BinaryFileData = {
42
42
  };
43
43
  export declare type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
44
44
  export declare type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
45
+ export declare type LastActiveToolBeforeEraser = {
46
+ type: typeof SHAPES[number]["value"] | "eraser";
47
+ customType: null;
48
+ } | {
49
+ type: "custom";
50
+ customType: string;
51
+ } | null;
45
52
  export declare type AppState = {
46
53
  isLoading: boolean;
47
54
  errorMessage: string | null;
@@ -56,7 +63,13 @@ export declare type AppState = {
56
63
  editingLinearElement: LinearElementEditor | null;
57
64
  activeTool: {
58
65
  type: typeof SHAPES[number]["value"] | "eraser";
59
- lastActiveToolBeforeEraser: typeof SHAPES[number]["value"] | null;
66
+ lastActiveToolBeforeEraser: LastActiveToolBeforeEraser;
67
+ locked: boolean;
68
+ customType: null;
69
+ } | {
70
+ type: "custom";
71
+ customType: string;
72
+ lastActiveToolBeforeEraser: LastActiveToolBeforeEraser;
60
73
  locked: boolean;
61
74
  };
62
75
  penMode: boolean;
@@ -217,6 +230,8 @@ export interface ExcalidrawProps {
217
230
  onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
218
231
  nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
219
232
  }>) => void;
233
+ onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
234
+ onScrollChange?: (scrollX: number, scrollY: number) => void;
220
235
  }
221
236
  export declare type SceneData = {
222
237
  elements?: ImportedDataState["elements"];
@@ -347,6 +362,7 @@ export declare type ExcalidrawImperativeAPI = {
347
362
  readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
348
363
  ready: true;
349
364
  id: string;
365
+ setActiveTool: InstanceType<typeof App>["setActiveTool"];
350
366
  app: InstanceType<typeof App>;
351
367
  };
352
368
  export declare type DeviceType = {
package/types/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { EVENT } from "./constants";
2
2
  import { FontFamilyValues, FontString } from "./element/types";
3
- import { AppState, Zoom } from "./types";
3
+ import { AppState, LastActiveToolBeforeEraser, Zoom } from "./types";
4
+ import { SHAPES } from "./shapes";
4
5
  export declare const setDateTimeForTests: (dateTime: string) => void;
5
6
  export declare const getDateTime: () => string;
6
7
  export declare const capitalizeString: (str: string) => string;
@@ -29,6 +30,14 @@ export declare const chunk: <T extends unknown>(array: readonly T[], size: numbe
29
30
  export declare const selectNode: (node: Element) => void;
30
31
  export declare const removeSelection: () => void;
31
32
  export declare const distance: (x: number, y: number) => number;
33
+ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
34
+ type: typeof SHAPES[number]["value"] | "eraser";
35
+ } | {
36
+ type: "custom";
37
+ customType: string;
38
+ }) & {
39
+ lastActiveToolBeforeEraser?: LastActiveToolBeforeEraser;
40
+ }) => AppState["activeTool"];
32
41
  export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
33
42
  export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
34
43
  export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;